Skip to content

Instantly share code, notes, and snippets.

<?php
$email = isset( $_GET['email'] ) ? $_GET['email'] : 'null';
$salt = isset( $_GET['salt'] ) ? $_GET['salt'] : '';
// hash email, split it up
$hash = str_split( sha1( $email . $salt ), 2 );
// use first 3 values for foreground
$foreground = "{$hash[0]}{$hash[1]}{$hash[2]}";
@scribu
scribu / latency.txt
Created May 31, 2012 09:07 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Disk seek (SSD) 100,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
@trepmal
trepmal / password-form-referer.php
Created September 21, 2012 02:44
[WordPress] Referer for password protected posts
<?php
/*
On an archive-type page, password-protected posts can be odd.
If the post is near the bottom, hitting submit reloads the page
taking you back to the top. This will simply change the referer
so that you are brought back to the post after clicking the
submit button on the password form.
*/
@ninnypants
ninnypants / allow-iframes.php
Created February 15, 2013 20:15
Allow iframe tags in wp editor
<?php
/*
Plugin Name: Frameitron
Plugin URI: http://ninnypants.com
Description: Allow iframes in tinymce for all user levels
Version: 1.0
Author: ninnypants
Author URI: http://ninnypants.com
License: GPL2
@trepmal
trepmal / easy-albums.php
Last active December 14, 2015 02:09
Put a group of galleries into an album, then put the album in a page.
<?php
// Better version over here:
// https://github.com/trepmal/Easy-Albums
//Plugin Name: Easy Albums
//Description: Put a group of galleries into an album, then put the album in a page.
/*
Quick release!
@ninnypants
ninnypants / sync-ms-users.php
Created April 13, 2013 23:49
Sync all users to newly created blogs
<?php
/*
Plugin Name: Sync Users
Plugin URI: http://ninnypants.com
Description: Sync users to new blogs as a subscriber
Version: 1.0
Author: ninnypants
Author URI: http://ninnypants.com
License: GPL2
@trepmal
trepmal / gallery-conversion.php
Last active February 6, 2017 00:03
Extract attachment IDs from selection, reinsert as gallery shortcode.
@ninnypants
ninnypants / display-site-ids.php
Created February 28, 2013 04:38
Show ID column in multisite Sites list table
<?php
/*
Plugin Name: Show Multisite IDs
Plugin URI: http://ninnypants.com
Description: Adds table column to show site ID
Version: 1.0
Author: ninnypants
Author URI: http://ninnypants.com
License: GPL2
@jimmynotjim
jimmynotjim / more-mute-regex.md
Created July 19, 2012 14:37 — forked from imathis/tweetbot-mute-regex.md
Tweetbot can use regular expressions to mute tweets in your timeline and mentions.

##Simply annoying Tweets

Annoyingly extended words (4+ of the same letter in a phrase): OOOOHHHHMMMMYYYYGGGGOOOODDDD

([a-z])/1{4}

Tweet w/ just a single hashtag: #omgthissucks

^ *#[^ ]+$
@ninnypants
ninnypants / gist-oembed.php
Created February 28, 2013 05:51
Quick WordPress plugin to add gists to oEmbed
<?php
/*
Plugin Name: Gist oEmbed
Plugin URI: http://ninnypants.com
Description: Embed gists into posts
Version: 1.0
Author: ninnypants
Author URI: http://ninnypants.com
License: GPL2