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
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- http://css-tricks.com/how-to-create-an-ie-only-stylesheet/ --> | |
<!--[if IE 7]> | |
<link rel="stylesheet" type="text/css" href="/stylesheets/ie7.css" /> <![endif]--> | |
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
// Example usage: | |
getjQuery(function (e) { | |
// jQuery loaded successfully! | |
}); | |
// Get jQuery on a page that doesn't have it, | |
// perhaps in order to engage in some laid-back hacking | |
function getjQuery(callback) { | |
loadScript("https://stripe.com/javascripts/jquery.js",callback); | |
} |
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
// ************************************ | |
// To use this code, run drawVeil(opacity,callback) | |
// ************************************ | |
function drawVeil(opacity,cb) { | |
// Use 0.5 by default | |
opacity = opacity || 0.5; | |
// If jQuery doesn't exist, get it |
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
// *Usage* | |
// Include the following as a bookmark: | |
// javascript: var gistSrc = "https://raw.github.com/gist/4022488/d8b31cf4fb663ce2b1afee89f3bd6bf72479c10c/quick-veil.js";console.log("Toggling veil, please wait...");function loadScript(src, optionalCallback) { var s = document.createElement("script"); s.type = "text/javascript"; s.src = src; var context = document.getElementsByTagName('script')[0]; context.parentNode.insertBefore(s, context); s.async = true; s.addEventListener('load', optionalCallback);}if(typeof veil_liev !== "undefined" && veil_liev) { jQuery("#veil-liev").stop().fadeTo(250, 0, function() { console.log("Veil lifted."); veil_liev = false; jQuery("#veil-liev").remove(); });} else { function afterLoadScript() { drawVeil(0.65, function(v) { veil = v; console.log("Veil dropped."); veil_liev = true; }); } if(typeof veil_liev !== "undefined") { afterLoadScript(); } else { loadScript(gistSrc, afterLoadScript); }} | |
// Source: | |
var gistSrc = "https://raw.github.com/gist/4022488/d8b31cf |
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
// The goal of this script is a dependency-free method of grabbing a remote chunk of javascript (i.e. jQuery) | |
// loadScript | |
function loadScript(src,optionalCallback) { var s = document.createElement("script"); s.type = "text/javascript"; s.src = src; var context = document.getElementsByTagName('script')[0]; context.parentNode.insertBefore(s, context); s.async=true; s.addEventListener('load',optionalCallback); } | |
// Example usage | |
loadScript("https://some.url",function(e){ | |
console.log("Script loaded successfully!"); | |
}); |
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 loadScript(src,optionalCallback) { var s = document.createElement("script"); s.type = "text/javascript"; s.src = src; var context = document.getElementsByTagName('script')[0]; context.parentNode.insertBefore(s, context); s.async=true; s.addEventListener('load',optionalCallback); } function getjQuery(callback){loadScript("https://stripe.com/javascripts/jquery.js",callback);} getjQuery(function (e) { console.log("\n\n","jQuery loaded successfully!"); }); |
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
var Storage; | |
// If this is running as a chrome extension, use chrome sync storage | |
if (chrome && chrome.storage && chrome.storage.sync) { | |
Storage = { | |
get: function (key,cb) { | |
chrome.storage.sync.get(key,function(result) { | |
cb(null,result && result[key]); | |
}); | |
}, |
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
/** | |
* Return fn which enforces required request params | |
* (Req parameter validation should be lenient, and marshal rowdy values) | |
*/ | |
exports.required = function(validationRules, cb) { | |
return function(req, res, next) { | |
// Keep track of list of validation errors | |
var errors = []; |
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
// An example sails adapter | |
module.exports = { | |
//////////////////////////////////////////////////////////////////////////////// | |
// | |
// Sails uses migrate() to synchronize the underlying data model with your app's schema. | |
// If any changes are detected in your models, migrate() is called when starting the server. | |
// | |
// Handle associations/references logic here (i.e. belongsTo,has, hasMany) | |
// |
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
# Add an alias to your .profile directly access the sublime binary | |
echo >> ~/.profile | |
echo 'alias sublime="/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl"' >> ~/.profile | |
# Make sublime your default text editor | |
echo >> ~/.profile | |
echo 'export EDITOR="subl -w"' >> ~/.profile | |
# Refresh your bash .profile | |
source ~/.profile |