Skip to content

Instantly share code, notes, and snippets.

View codearachnid's full-sized avatar
🎯
Focusing

Timothy Wood codearachnid

🎯
Focusing
View GitHub Profile
<?php
/*
Plugin Name: Instrument Hooks for WordPress
Description: Instruments Hooks for a Page. Outputs during the Shutdown Hook.
Version: 0.1
Author: Mike Schinkel
Author URI: http://mikeschinkel.com
*/
if (isset($_GET['instrument']) && $_GET['instrument']=='hooks') {
@ryanflorence
ryanflorence / static_server.js
Last active April 26, 2024 16:18
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@andyedinborough
andyedinborough / jquery.oauth.js
Created June 7, 2011 19:30
Introduces $.oauth() to make using OAuth from jQuery as easy as using $.ajax()
(function (window, document, $, undefined) {
if (!$.Deferred) throw 'jQuery 1.5 is required to use the jQuery.oauth script!';
function require(name, url) {
if (window[name] === undefined)
return $.ajax({ type: 'GET', cache: true, dataType: 'script', url: url });
}
$.oauth = function (options) {
var d = $.Deferred();
@staydecent
staydecent / media_queries.css
Created June 12, 2011 17:46
Example of various media queries for responsive web design.
/* Media queries used on blog.staydecent.ca by Adrian Unger
check my full source at:
http://blog.staydecent.ca/static/css/style-0.1.6.css */
@media only screen and (min-width:768px) and (max-width:1269px) {
/* In my particular design, I used a fluid grid limited to a
max-width of 1140px, while (if there is enough room)
pushing the menu outside of layout, requiring a total
limit of at least 1270px.
So, this first query applies to any screen-width less
@ffub
ffub / gist:1084424
Created July 15, 2011 10:10
Balsamiq HTML export
#!/usr/bin/php
<?php
error_reporting(E_ALL);
if (count($argv) <= 1) {
print("usage createMockup src_dir dst_dir images_dir\n");
print("\tsrc_dir : dir where all bmml file are\n");
print("\tdst_dir : dir where write all html files\n");
print("\timages_dir : dir where all export mockup png are (will be copied to the \$dst_dir/images directory)\n");
exit(1);
}
@ironsjp
ironsjp / cls.js
Created July 18, 2011 14:42
cache script and css to localStorage (same domain only)
/**
* cache script and css to localStorage (same domain only)
*
* $CLS.style("a.css");
*
* $CLS.script("jquery-1.5.2.min.js").wait()
* .script("a.js")
* .script("b.js")
* .script("c.js")
* .wait(function() {
@traeblain
traeblain / tmb-wpmu-nag-remove.php
Created July 20, 2011 04:26
Remove WPMU's Horribly Useless Notification Plugin Nag
<?php
/*
Plugin Name: Remove WPMU Notification Plugin Nag
Plugin URI: http://wp.me/p1Aj2B-6g
Description: WPMU started trying to force people that use plugins by their developers to install a Notification plugin by making a persistent notification bug the admins. This removes that annoying piece.
Version: 1.2
Author: Trae Blain
Author URI: http://traeblain.com
License: GPL2
*/
@hyle
hyle / ko.utils.signatures.js
Last active May 14, 2022 21:15
KnockoutJS utils (ko.utils) signatures
// knockout 2.2.1
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
ko.utils.arrayForEach = function (array, action) { /* .. */ }
ko.utils.arrayGetDistinctValues = function (array) { /* .. */ }
@dieseltravis
dieseltravis / iisexpress.bat
Last active January 5, 2016 13:35
Add a shortcut to your Send To menu to launch a folder in IISExpress
@echo off
:: normalize folder
SET folder=%~1
IF %folder:~-1%==\ SET folder=%folder:~0,-1%
:: random number from 8000 to 9999
SET /a port=(%random%)*1999/32767+8000
:: start the web server for the random port starting at the passed-in directory
@chrishomer
chrishomer / ec2-ebs-instance-resize.sh
Created October 17, 2011 18:05
Resizing an instance backed by an EBS drive on ec2
# IMPORTANT: On your machine, with the ec2 instance running
# Basic Config variables
instanceid=<instance-id>
size=50
#Get the root EBS volume id and availability zone for this instance:
oldvolumeid=$(ec2-describe-instances $instanceid |
egrep "^BLOCKDEVICE./dev/sda1" | cut -f3)
zone=$(ec2-describe-instances $instanceid | egrep ^INSTANCE | cut -f12)
echo "instance $instanceid in $zone with original volume $oldvolumeid"