Skip to content

Instantly share code, notes, and snippets.

View michaelfox's full-sized avatar
🦊

Michael Fox michaelfox

🦊
  • Kirschbaum Development Group
View GitHub Profile
<?php
/**
* generate a subhead with an anchor tag
*
* Usage:
* echo subhead("How it Actually Works");
* Prints:
* <h2 id="how-it-actually-works">How it Actually Works</h2>
*
* @param string $name
@michaelfox
michaelfox / chrome-shortcut-manager-settings.js
Created October 8, 2010 05:20
My settings for Chrome shortcut manager extension
// ==UserScript==
// @ShortcutManager
// @name Quix
// @namespace http://www.michaelfox.name
// @key Ctrl+q
// @include *
// ==/UserScript==
javascript:Quix();function%20Quix()%7Bvar%20e=encodeURIComponent;var%20t=window.getSelection?window.getSelection():(document.getSelection?document.getSelection():(document.selection?document.selection.createRange().text:''));var%20c=window.prompt('Quix:%20Type%20%60help%60%20for%20a%20list%20of%20commands:');if(t!='')%7Bif(c)%7Bc+='%20'+t;%7Delse%7Bc=''+t;%7D%7Dif(c)%7Bvar%20u='http://www.quixapp.com/go/?c='+e(c)+'&t='+(document.title?e(document.title):'')+'&s=https://dl.dropbox.com/s/jpc1gu600xunbs5/quix.txt'+'&v=081'+'&u='+(document.location?e(document.location):'');d=''+document.location;if(d.substr(0,4)!='http')%7Bwindow.location=u+'&mode=direct';%7Delse%7Bheads=document.getElementsByTagName('head');if(c.substring(0,1)=='%20')%7Bvar%20w=window.open(u+'&mode=direct');w.focus();%7Delse%20if(heads.length==0)%7Bwindow.location=u+'&mode=direct';%7Delse%7Bq=document.getEle
@michaelfox
michaelfox / quix-chrome-search.js
Created October 8, 2010 05:23
JavaScript to use Quix as a search engine in Google Chrome
javascript:Quix();function Quix()%7Bvar e=encodeURIComponent;var t=window.getSelection?window.getSelection():(document.getSelection?document.getSelection():(document.selection?document.selection.createRange().text:''));var c="%s";if(t!='')%7Bif(c)%7Bc+=' '+t}else%7Bc=''+t}}if(c)%7Bvar u='http://quixapp.com/go/?c='+e(c)+'&t='+(document.title?e(document.title):'')+'&s=http://github.com/michaelfox/Quix-Commands/raw/master/quix.txt'+'&v=080'+'&u='+(document.location?e(document.location):'');d=''+document.location;if(d.substr(0,4)!='http')%7Bwindow.location=u+'&mode=direct'}else%7Bheads=document.getElementsByTagName('head');if(c.substring(0,1)==' ')%7Bvar w=window.open(u+'&mode=direct');w.focus()}else if(heads.length==0)%7Bwindow.location=u+'&mode=direct'}else%7Bq=document.getElementById('quix');if(q)%7Bq.parentNode.removeChild(q)}sc=document.createElement('script');sc.src=u;sc.id='quix';sc.type='text/javascript';void(heads[0].appendChild(sc))}}}}
@michaelfox
michaelfox / robots.txt
Created November 5, 2010 01:08
Boilerplate Robots.txt Template
# www.robotstxt.org/
# www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156449
User-agent: *
Disallow: /admin
# Development
Disallow: /
# Allow: /
@michaelfox
michaelfox / analytics-multiple-accounts-async.html
Created December 6, 2010 22:22
Google Analytics JavaScript Snippet for Multiple Accounts Using the Asynchronous Code
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-65432-1']);
_gaq.push(['_trackPageview']);
/**
* add a second GA Account
* @see http://code.google.com/apis/analytics/docs/gaJS/gaJSApi_gaq.html
@michaelfox
michaelfox / chrome-keywords.sql
Created December 16, 2010 20:05
Google Chrome Keywords Export
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE "keywords" (id INTEGER PRIMARY KEY,short_name VARCHAR NOT NULL,keyword VARCHAR NOT NULL,favicon_url VARCHAR NOT NULL,url VARCHAR NOT NULL,show_in_default_list INTEGER,safe_for_autoreplace INTEGER,originating_url VARCHAR,date_created INTEGER DEFAULT 0,usage_count INTEGER DEFAULT 0,input_encodings VARCHAR,suggest_url VARCHAR,prepopulate_id INTEGER DEFAULT 0,autogenerate_keyword INTEGER DEFAULT 0,logo_id INTEGER DEFAULT 0,created_by_policy INTEGER DEFAULT 0,instant_url VARCHAR);
INSERT INTO "keywords" VALUES(2,'Google','g','http://www.google.com/favicon.ico','{google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q={searchTerms}',1,0,'',0,46,'UTF-8','{google:baseSuggestURL}search?client=chrome&hl={language}&q={searchTerms}',1,0,6247,0,'{google:baseURL}webhp?{google:RLZ}sourceid=chrome-instant&ie={inputEncoding}&ion=1{searchTerms}');
INSERT INTO "keywords" VALUES(5,'Quix','q','','j
@michaelfox
michaelfox / Custom.css
Created January 4, 2011 21:15
Google Chrome Custom User Stylesheet
/**
*
* ___ __ _
* / __|__ _ _ __ _ __ / _(_)_ _ ___
* | (__/ _` | ' \| '_ \ _| | '_/ -_)
* \___\__,_|_|_|_| .__/_| |_|_| \___|
* |_|
**/
/* Remove "Entered the room" -- "left the room" type messages */
body.chat table.chat #chat tr.timestamp_message + tr.timestamp_message,
@michaelfox
michaelfox / textmate-project-file-folder-patterns.md
Created March 4, 2011 15:04
Various notes and Regex expressions for file and folder matching patterns within TextMate projects

Defaults

File Pattern:

!(/\.(?!htaccess)[^/]*|\.(tmproj|o|pyc)|/Icon\r|/svn-commit(\.[2-9])?\.tmp)$

Folder Pattern:

@michaelfox
michaelfox / DOM Monster.js
Created March 5, 2011 15:54
A largely un-curated "dump" of JavaScript Bookmarklets
javascript:(function(){var%20script=document.createElement('script');script.src='http://mir.aculo.us/dom-monster/dommonster.js?'+Math.floor((+new Date)/(864e5));document.body.appendChild(script);})()
@michaelfox
michaelfox / Plist_parser.php
Created March 26, 2011 19:30
A PHP Class for Parsing OS X Plist files
<?php
/**
* Plist Parser Class
*
* Usage:
* ======
* $plist = Plist::from_file("~/Music/iTunes/iTunes Music Library.xml");
* print_r($plist->as_array());
*/