This file contains hidden or 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
// http://davidwalsh.name/javascript-once | |
function once(fn, context) { | |
var result; | |
return function() { | |
if(fn) { | |
result = fn.apply(context || this, arguments); | |
fn = null; | |
} |
This file contains hidden or 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
# Deployment via scp | |
keyfile="/path/id_rsa" | |
username="username" | |
servername="servername" | |
remotePath="/path" | |
files="path/folder path/path/folder" | |
scp -i $keyfile -r $files $username@$servername:$remotePath |
This file contains hidden or 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
// Mixin: HiDPI mixin. | |
// Description: Default value set to 1.3 to target Google Nexus 7 | |
// (http://bjango.com/articles/min-device-pixel-ratio/). | |
// | |
// Example usage: @include hidpi($ration) { ... } | |
@mixin hidpi($ratio: 1.3) { | |
@media only screen and (-webkit-min-device-pixel-ratio: $ratio), | |
only screen and (min--moz-device-pixel-ratio: $ratio), | |
only screen and (-o-min-device-pixel-ratio: #{$ratio}/1), |
This file contains hidden or 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
console.log((function(selector){ | |
var parent = document.querySelectorAll(selector), | |
childs = parent[0].querySelectorAll('*'), | |
// Make a array of `parent` and `childs` NodeList. | |
elements = Array.prototype.slice.call(parent).concat(Array.prototype.slice.call(childs)), | |
styles = []; | |
var i = elements.length, | |
matchedCSSRules, |
This file contains hidden or 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
<html> | |
<body> | |
<a href="#" onclick="lazyEval('js-module')">lazyEval</a> | |
<script id="js-module"> | |
/* | |
alert('lazyEval'); | |
*/ | |
</script> |
This file contains hidden or 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
var express = require('express'); | |
var oauth = require('oauth'); | |
var oa; | |
var app = express.createServer(); | |
app.get('/', function (req, res) { | |
res.end('<!DOCTYPE html><meta charset=utf-8><form action=/authorize><label>Client ID: <input type=text name=client_id required autofocus></label><br><label>Client Secret: <input type=text name=client_secret required></label><br><label>Scope: <input type=text name=scope required></label><br><input type=submit>'); | |
}); | |
app.get('/authorize', function (req, res) { |
This file contains hidden or 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
<div id="bar"> | |
<div id="top"> | |
<div class="background"></div> | |
</div> | |
<div id="front"> | |
<div class="background"></div> | |
</div> | |
</div> | |
<div id="slider"></div> |