This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function urlInfo (url) { | |
var props = 'hash host hostname href origin password pathname port protocol username search'; | |
if (!window.urlInfoAnchorElement) | |
window.urlInfoAnchorElement = document.createElement('a'); | |
urlInfoAnchorElement.href = url; | |
return props.split(' ').reduce(function (m, v, i) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = function (func) { | |
return func.toString() | |
.replace(/^[^{]+{\s*\/\*\s*/m, "") | |
.replace(/\s*\*\/\s*}$/m, ""); | |
}; | |
var str = m(function(){/* | |
everything in here | |
is a multiline string | |
it is a secret. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Hybrid singletons. removes the need for 'new' */ | |
/* Really more an experiment than anything */ | |
function Person (name, age) { | |
var parentFn = this[arguments.callee.name]; | |
if (parentFn && !(this instanceof parentFn)) | |
return new (Function.prototype.bind.apply( | |
parentFn, [this].concat(Array.from(arguments)))); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function throttle (fn, limit) { | |
var wait = false; | |
return function () { | |
if (wait) return; | |
fn.call(); wait = true; | |
setTimeout(function () { wait = false; }, limit); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
var speed = 80, times = 3; | |
$(document).on('mouseover', '[data-shuffle]', function (e) { | |
var $this = $(this); | |
if (!$this.data('text')) | |
$this.data('text', $this.text()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
var speed = 80, times = 3; | |
$(document).on('mouseover', '[data-shuffle]', function (e) { | |
var $this = $(this); | |
if (!$this.data('text')) | |
$this.data('text', $this.text()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'json' | |
photos = JSON.parse(`instagram-screen-scrape -u #{ARGV[0]}`).each { |p| | |
system("curl -LO #{p['image']}") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arr = [1, 2, 3, 4] | |
arr.slice(0, -2).concat([arr.slice(-2).join(' and ')]).join(', ') | |
// => '1, 2, 3 and 4' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SRC=./src | |
SECONDS=1 | |
on_change () { | |
# $1, $2, $3... etc. are the files created/modified | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function mkdirpSync () { | |
var fs = require('fs') | |
, path = require('path'); | |
var dirPaths = Array.from(arguments); | |
dirPaths.forEach(function (dirPath) { | |
var parts = dirPath.split(path.sep); | |
for( var i = 1; i <= parts.length; i++ ) { |