most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat| var util = exports || {}; | |
| util.mergeDeep = function (A, B, depth) { | |
| var forever = depth == null; | |
| for (var p in B) { | |
| if (B[p] != null && B[p].constructor==Object && (forever || depth > 0)) { | |
| A[p] = util.mergeDeep( | |
| A.hasOwnProperty(p) ? A[p] : {}, | |
| B[p], |
| <?php | |
| // Register the column | |
| function price_column_register( $columns ) { | |
| $columns['price'] = __( 'Price', 'my-plugin' ); | |
| return $columns; | |
| } | |
| add_filter( 'manage_edit-post_columns', 'price_column_register' ); |
| function slugify(text) | |
| { | |
| return text.toString().toLowerCase() | |
| .replace(/\s+/g, '-') // Replace spaces with - | |
| .replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
| .replace(/\-\-+/g, '-') // Replace multiple - with single - | |
| .replace(/^-+/, '') // Trim - from start of text | |
| .replace(/-+$/, ''); // Trim - from end of text | |
| } |
| <?php | |
| /** | |
| * WordPress function for redirecting users on login based on user role | |
| */ | |
| function my_login_redirect( $url, $request, $user ){ | |
| if( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) { | |
| if( $user->has_cap( 'administrator' ) ) { | |
| $url = admin_url(); | |
| } else { |
| <?php | |
| /** | |
| * gets the current post type in the WordPress Admin | |
| */ | |
| function get_current_post_type() { | |
| global $post, $typenow, $current_screen; | |
| //we have a post so we can just get the post type from that | |
| if ( $post && $post->post_type ) | |
| return $post->post_type; |
| ## Configure eth0 | |
| # | |
| # vi /etc/sysconfig/network-scripts/ifcfg-eth0 | |
| DEVICE="eth0" | |
| NM_CONTROLLED="yes" | |
| ONBOOT=yes | |
| HWADDR=A4:BA:DB:37:F1:04 | |
| TYPE=Ethernet | |
| BOOTPROTO=static |
| <?php | |
| //Get data from instagram api | |
| $hashtag = 'max'; | |
| //Query need client_id or access_token | |
| $query = array( | |
| 'client_id' => '', | |
| 'count' => 3 | |
| ); | |
| $url = 'https://api.instagram.com/v1/tags/'.$hashtag.'/media/recent?'.http_build_query($query); |
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
| /** | |
| * author Remy Sharp | |
| * url http://remysharp.com/tag/marquee | |
| */ | |
| (function ($) { | |
| $.fn.marquee = function (klass) { | |
| var newMarquee = [], | |
| last = this.length; |