Skip to content

Instantly share code, notes, and snippets.

View pifantastic's full-sized avatar

Aaron Forsander pifantastic

  • Stripe
  • Austin, TX
View GitHub Profile
@pifantastic
pifantastic / index.html
Created January 26, 2011 00:03
A simple todo list I'm using for an Intro to jQuery talk.
<!DOCTYPE hmtl>
<html>
<head><title>My todo list</title></head>
<body>
<h1>My todo list:</h1>
<form>
<input type="text" id="item" />
<input type="submit" id="save" value="Save" />
</form>
<ul id="list"></ul>
@pifantastic
pifantastic / README.md
Created December 16, 2013 17:34
Create this file in your project's root dir: `.git/hooks/pre-commit` Make it executable: `chmod +x .git/hooks/pre-commit` You can remove `test` if you just want to `lint` and vice versa.

Create this file in your project's root dir: .git/hooks/pre-commit

Make it executable: chmod +x .git/hooks/pre-commit

You can remove test if you just want to lint and vice versa.

// Allow tasks to inherit a target.
var targetify = function( tasks ) {
return function( target ) {
grunt.task.run( tasks.map(function( name ) {
// Target may be blank.
return target ? name + ':' + target : name;
}));
};
};
package main
import (
"fmt"
goquery "github.com/PuerkitoBio/goquery"
"sync"
"time"
)
var start = time.Now()
function foo(a){var b=a;return function c(a){return"undefined"!=typeof a?(b+=' '+a,c):(console.log(b),void 0)}}foo("lol")("wat")("bar")();
foo("lol")("wat")("bar")(); // "lol wat bar"
var colorHash = function (str) {
// djb2 hash: http://www.cse.yorku.ca/~oz/hash.html
var hash = 5381;
for (i = 0; i < str.length; i++) {
hash = ((hash << 5) + hash) + str.charCodeAt(i);
}
// Help from: http://www.paulirish.com/2009/random-hex-color-code-snippets/
var color = Math.round(11184810 * Math.abs(hash) / Math.pow(2, 32));
@pifantastic
pifantastic / thing.js
Last active December 10, 2015 00:59 — forked from cowboy/thing.js
function Thing(prop) {
this.prop = prop;
}
Thing.prototype.toString = function() {
return "My prop is: " + this.prop;
};
module.exports = function (opts) {
return new Thing(opts);
var zlib = require('zlib');
var tar = require('tar');
var dir = __dirname + '/someSEOJob';
request(url)
.pipe(zlib.createGunzip())
.pipe(tar.Extract({ path: dir }))
.on("error", function (err) {
console.error(err)
$('body, header, header h1, .page-element').css({
'background-color' : '#111',
'color' : '#E5E5E5'
});
$('.live-config').css('color', '#333');
$('.configOpen').css('color', '#E5E5E5');