Skip to content

Instantly share code, notes, and snippets.

Michael Fox michaelfox

Block or report user

Report or block michaelfox

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am michaelfox on github.
  • I am michaelfox (https://keybase.io/michaelfox) on keybase.
  • I have a public key ASBGi0B0HzDkYT0KTVWSJO7KtLySf8opq9tDtV_4MTiLZgo

To claim this, I am signing this object:

@michaelfox
michaelfox / form-restore.bm.js
Created May 22, 2014
Form Save / Restore Bookmarklets
View form-restore.bm.js
javascript:(function(e%2Ct%2Ci%2Co%2Cn%2Ca%2Cr%2Cc)%7Bif(!(n%3De.jQuery)%7C%7Ci%3En.fn.jquery%7C%7Co(n))%7Ba%3Dt.createElement(%22script%22)%3Ba.type%3D%22text%2Fjavascript%22%3Ba.src%3D%22http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F%22%2Bi%2B%22%2Fjquery.min.js%22%3Ba.onload%3Da.onreadystatechange%3Dfunction()%7Bif(!r%26%26(!(c%3Dthis.readyState)%7C%7C%22loaded%22%3D%3D%3Dc%7C%7C%22complete%22%3D%3D%3Dc))%7Bo((n%3De.jQuery).noConflict(1)%2Cr%3D1)%3Bn(a).remove()%7D%7D%3Bt.documentElement.childNodes%5B0%5D.appendChild(a)%7D%7D)(window%2Cdocument%2C%221.11.0%22%2Cfunction(e)%7Bfunction%20t(t)%7Bvar%20i%3De(t)%2Co%3D%5B%22id%22%2C%22name%22%2C%22action%22%5D%2Cn%3Dfalse%3Be.each(o%2Cfunction(e%2Ct)%7Bif(!n%26%26i.attr(t))n%3Di.attr(t)%7D)%3Breturn%20n%7De.unserialize%3Dfunction(e)%7Bfor(var%20t%2Ci%2Co%3DdecodeURI(e.replace(%2F%5C%2B%2Fg%2C%22%20%22))%2Cn%3Do.split(%22%26%22)%2Ca%3D%7B%7D%2Cr%3D0%2Cc%3Dn.length%3Br%3Cc%3Br%2B%2B)%7Bt%3Dn%5Br%5D.split(%22%3D%22)%3Bi%3Dt%5B0%5D%3Bif(void%200%3D%3D%3
@michaelfox
michaelfox / wordpress-create-user.php
Created Apr 22, 2013
Create a user in WordPress from a php page/script outside of the WordPress system.
View wordpress-create-user.php
<?php
// [wp insert user « WordPress Codex](http://codex.wordpress.org/Function_Reference/wp_insert_user)
require_once "wordpress/wp-load.php";
$user_info = array(
"user_pass" => "test123",
"user_login" => "username",
"user_nicename" => "username",
"user_email" => "email@example.com",
@michaelfox
michaelfox / tablesort.js
Created Apr 17, 2013
Bookmarklet to make tables sortable. (Doesn't work everywhere)
View tablesort.js
javascript:function toArray (c){var a, k;a=new Array;for (k=0; k<c.length; ++k)a[k]=c[k];return a;}function insAtTop(par,child){if(par.childNodes.length) par.insertBefore(child, par.childNodes[0]);else par.appendChild(child);}function countCols(tab){var nCols, i;nCols=0;for(i=0;i<tab.rows.length;++i)if(tab.rows[i].cells.length>nCols)nCols=tab.rows[i].cells.length;return nCols;}function makeHeaderLink(tableNo, colNo, ord){var link;link=document.createElement('a');link.href='javascript:sortTable('+tableNo+','+colNo+','+ord+');';link.appendChild(document.createTextNode((ord>0)?'a':'d'));return link;}function makeHeader(tableNo,nCols){var header, headerCell, i;header=document.createElement('tr');for(i=0;i<nCols;++i){headerCell=document.createElement('td');headerCell.appendChild(makeHeaderLink(tableNo,i,1));headerCell.appendChild(document.createTextNode('/'));headerCell.appendChild(makeHeaderLink(tableNo,i,-1));header.appendChild(headerCell);}return header;}g_tables=toArray(document.getElementsByTagName('table'));
@michaelfox
michaelfox / git-init-steps.sh
Created Apr 9, 2013
Initialize git in an existing project...
View git-init-steps.sh
git init
touch .gitignore
# edit .gitignore to ignore files you don't want tracked
git add .
git commit -m 'Initial Commit'
git remote add origin <github-url>
git push origin master
@michaelfox
michaelfox / MY_Model-sort_literal.php
Created Feb 22, 2013
Function for MY_Model that allows you to do FIND_IN_SET() Ordering via the CodeIgniter Active Record Class.
View MY_Model-sort_literal.php
<?php
/**
* http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_find-in-set
*
* @param field
* @param first_value, second_value, ...
*/
public function sort_literal() {
$args = func_get_args();
@michaelfox
michaelfox / dev-vhost.conf
Created Feb 12, 2013
Basic apache vhost template for use on local development environments.
View dev-vhost.conf
# Site: sitename.local
<VirtualHost *:80>
ServerName sitename.local
ServerAlias *.sitename.local
DirectoryIndex index.php index.html
DocumentRoot "/www/sitename/web"
View .htaccess
<IfModule mod_rewrite.c>
# Force www
RewriteEngine on
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
RewriteRule ^ http(?%1s)://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
@michaelfox
michaelfox / brettquix.txt
Created Jun 28, 2012 — forked from ttscoff/brettquix.txt
Brett's Quix File
View brettquix.txt
@Brett's searches
@Brett's custom searches
go https://duckduckgo.com/?q=%21%20%s Open first result (DuckDuckGo)
b https://duckduckgo.com/?q=%21%s Bang search (DuckDuckGo)
grep https://www.cueup.com/?q=%s&fq=1 Greplin
ss https://duckduckgo.com/site:%d%20%s Current site (DuckDuckGo)
bt https://duckduckgo.com/site:brettterpstra.com%20%s BrettTerpstra.com (DuckDuckGo)
gh http://github.com/search?q=%s&type=Everything&repo=&langOverride=&start_value=1 Search GitHub (everything)
hints http://hints.macworld.com/search.php?query=%s&keyType=all&datestart=&dateend=&topic=0&type=stories&results=50&mode=search Search Mac OS X Hints
mu http://www.macupdate.com/find/mac/%s Search MacUpdate (Software)
@michaelfox
michaelfox / email-regex.md
Created Jun 14, 2012
HTML5 Email Regex Pattern
View email-regex.md

See html5.org/r/6884

/^[a-zA-Z0-9.!#$%&'*+-/=?\^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
You can’t perform that action at this time.