Skip to content

Instantly share code, notes, and snippets.

View tanepiper's full-sized avatar

Tane Piper tanepiper

View GitHub Profile
@tanepiper
tanepiper / process.nextTick.js
Created June 19, 2012 10:59 — forked from WebReflection/process.nextTick.js
process.nextTick(callback) for browsers too
!function (window) {"use strict";
// by WebReflection - WTFPL License
var
prefixes = "r webkitR mozR msR oR".split(" "),
process = "process",
nextTick = "nextTick",
i = 0,
p = window[process] || (window[process] = {})
;
while (!p[nextTick] && i < prefixes.length)
@tanepiper
tanepiper / connect.js
Created June 19, 2012 10:28
new pipe-able dnode api
var dnode = require('../../lib/dnode');
var net = require('net');
var d = new dnode();
d.on('remote', function (remote) {
remote.transform('beep', function (s) {
console.log('beep => ' + s);
d.end();
});
});
@tanepiper
tanepiper / output.log
Created June 14, 2012 08:34
curl node repl (possibly dangerous?)
josh@onix:/tmp/http-repl$ curl -sSNT. localhost:8000
Actual repl over http. NOW WITH A LIMITED CONTEXT!!
>> help
'Exits are North, South and Dennis.'
>> .exit
Terminal exiting.
You'll want to mash ctrl-c.
^C
josh@onix:/tmp/http-repl$
@tanepiper
tanepiper / dabblet.css
Created May 10, 2012 10:43 — forked from daneden/dabblet.css
Responsive Images
/* Responsive Images */
.r-img {
background-size: 100%;
display: inline-block;
zoom: 1;
*display: inline; /* Mimic inline-block on old IE */
}
@media screen and (max-width: 600px) { /* Hide background on low res */
@tanepiper
tanepiper / hack.sh
Created May 10, 2012 10:24 — forked from aquaxp/osx_config.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
// Make SVG Play nice with bad browsers
$(document).ready(function() {
if (Modernizr.inlinesvg) {
//SVG.
$('#logo').html('<img src="/assets/img/logo.svg" alt="Crafty Devil" />');
} else {
//No SVG.
$('#logo').html('<img src="/assets/img/logo.png" alt="Your Company" />');
@tanepiper
tanepiper / cssTo.coffee
Created May 7, 2012 10:08 — forked from minodisk/cssTo.coffee
CSS animation with callback style
cssTo = (elem, prop, time, easing, callback)->
time = "#{time / 1000}s"
transitions = []
for key, value of prop
transitions.push "#{key} #{time} #{easing}"
transition = transitions.join ', '
listener = (e)->
elem.removeEventListener 'webkitTransitionEnd', listener
elem.style['-webkit-transition'] = ''
@tanepiper
tanepiper / hack.sh
Created March 31, 2012 14:22 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@tanepiper
tanepiper / gist:2039373
Created March 14, 2012 20:44 — forked from anonymous/gist:2039312
SASS mixins for roundcorners
// Example of a whole load of mixins to make round corners
// (including individual corners) easy to remember in SASS
@mixin roundcorners($radius) {
-moz-border-radius: $radius; // firefox
-webkit-border-radius: $radius; // safari/chrome
border-radius: $radius; // CSS3, works in IE9
}
@mixin roundcorner1($radius, $corner: "top-left") {
-moz-border-#{$corner}-radius: $radius ; // firefox
@tanepiper
tanepiper / horrible.js
Created February 28, 2012 22:51 — forked from tmpvar/horrible.js
javascript: hackery in jsdom
var jsdom = require('jsdom');
window.log = console.log;
var window = jsdom.jsdom('<a href="javascript:log(\'clicked!\');">click me</a>').createWindow();
var a = window.document.getElementsByTagName('a')[0];
a.addEventListener('click', function(e) {
if (e.target.href.substring(0,10) === "javascript") {
window.run(e.target.href.substring(11), 'click-handler');
}
});