Skip to content

Instantly share code, notes, and snippets.

// by Douglas Bonneville | bonfx.com
// http://bonfx.com/gorgeous-random-color-scheme-gradient-generator-for-photoshop
// preferences
app.preferences.rulerUnits = Units.PIXELS
// constants
var lenWidth = 500
var quad = lenWidth/2;
@jbach
jbach / uri.js
Created September 6, 2012 06:14 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@jbach
jbach / getscript.js
Created September 4, 2012 17:20
getScript() - load scripts asynchronously w/375 bytes of code - e.g. `getScript(src, cb)`
// # getScript()
// more or less stolen from jquery core and adapted by paul irish
function getScript(url,success) {
var head = document.getElementsByTagName("head")[0], done = false;
var script = document.createElement("script");
script.src = url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function(){
if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") ) {