Do stuff when editing or writing a certain custom post type?

Here you go:

add_action("admin_print_scripts","load_my_script");
function load_my_script() {
    global $pagenow, $typenow;
    if (is_admin() && $pagenow=='post-new.php' OR $pagenow=='post.php' && $typenow=='Custom_post_type_name') {
        wp_enqueue_script('jquery');
    }
}

just change Custom_post_type_name to the actual name of your custom post type and enqueue your script.