Skip to content

Instantly share code, notes, and snippets.

View justinrainbow's full-sized avatar

Justin Rainbow justinrainbow

View GitHub Profile
@justinrainbow
justinrainbow / remote-tail.js
Created May 16, 2011 19:58
Tail a remote file on multiple servers with Node.js
var sys = require('sys'),
spawn = require('child_process').spawn,
// args from command line
filename, servers;
if (process.ARGV.length < 4) {
return sys.puts("Usage: node remote-tail.js filename server1 [serverN]");
}
#!/usr/bin/perl
#
# Nathanial Hendler
# http://retards.org/
#
# 2001-06-26 v1.0
#
# This perl script parses a MySQL slow_queries log file
# ignoring all queries less than $min_time and prints
# out how many times a query was greater than $min_time
@justinrainbow
justinrainbow / model-router.js
Created November 18, 2011 18:55
Extension to add simple routing to a model
YUI.add('sk-gallery-model-router', function (Y) {
/* Any frequently used shortcuts, strings and constants */
var Lang = Y.Lang;
function ModelRouter(config) {
}
ModelRouter.prototype = {
getUrl: function (action) {
@justinrainbow
justinrainbow / build-yui-loader.js
Created January 23, 2012 19:03
Builds a YUI Loader config for all your custom YUI3 modules
var util = require('util'),
exec = require('child_process').exec,
modules = {},
// what to strip off the pathname (/my/dir/web becomes /web)
docroot = __dirname+'/webroot',
// where to search for YUI.add in files
path = __dirname+'/webroot/bundles',
file,
child;
@justinrainbow
justinrainbow / git-homepage
Created February 2, 2012 20:26
Add this to your path to add the 'git homepage' command to git. This will open the URL for the current git repo.
#!/usr/bin/env php
<?php
// This is incredibly ugly... but a quick script for fun
exec("git remote -v", $data);
$remotes = array();
foreach ($data as $line) {
if (preg_match('~^(\w+)\t(.+?(?:\.git)+)~', $line, $match)) {
@justinrainbow
justinrainbow / .ackrc
Created February 13, 2012 16:48
My ack conf file
# General Ack Settings
####################################################################
# only search with case sensitivity if there is mixed case
--smart-case
# follow symlinks
--follow
# Ack Type Settings
@justinrainbow
justinrainbow / gist:2002574
Created March 8, 2012 18:38
Hipchat emoticon list
:-)
:)
:-)
:o
:$
:/
:(
:-*
:#
:'(
@justinrainbow
justinrainbow / watch.js
Created March 27, 2012 21:19
Auto building of YUI3 modules
var watch = require('watch'),
spawn = require('child_process').spawn,
queue = [],
proc;
function run(path) {
if (proc) {
return queue.push(path);
}
@justinrainbow
justinrainbow / gist:2294905
Created April 3, 2012 19:25
see all the gifs on bukk.it at once
var r=/gif$/,b=document.body,i="",h="innerHTML";b[h].replace(/href="([^"]*?)"/g,function(m,u){if(r.test(u))i+="<img src='"+u+"'>"});b[h]=i;