Skip to content

Instantly share code, notes, and snippets.

🌲
lost in the woods

Tim Branyen tbranyen

🌲
lost in the woods
Block or report user

Report or block tbranyen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View jquery.ba-deparam.js
// jQuery Deparam - v0.1.0 - 6/14/2011
// http://benalman.com/
// Copyright (c) 2011 Ben Alman; Licensed MIT, GPL
(function(window) {
// Creating an internal undef value is safer than using undefined, in case it
// was ever overwritten.
var undef;
// A handy reference.
var decode = decodeURIComponent;
View uri.js
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"
View gist:c10b8c3ace7daee3f6de
The error:
Error: Error: ENOENT, no such file or directory '/Users/Jmeas/Bocoup/admiralty/client.src/client.src/core/index.js'
---------
The directory structure:
client.src/
bower_components/
View jquery_usage.js
// Use an AMD package here to gain access to nested internal modules.
require.config({
packages: [{
name: "jquery",
location: "vendor/jquery/src",
main: "index.js"
}]
});
// If we are using AMD, we don't care about core.
View forEach.js
var forEach = function(list, callback) {
return Array.prototype.forEach.call(list, callback);
};
@tbranyen
tbranyen / handlebars.object_helpers.js
Created Sep 26, 2012 — forked from strathmeyer/handlebars.object_helpers.js
Handlebars.js helpers to iterate over objects
View handlebars.object_helpers.js
// HELPER: #key_value
//
// Usage: {{#key_value obj}} Key: {{key}} // Value: {{value}} {{/key_value}}
//
// Iterate over an object, setting 'key' and 'value' for each property in
// the object.
Handlebars.registerHelper("key_value", function(obj, options) {
var buffer = "",
key;
View backbone.js
//This is the line from the stack-trace that's causing the error:
//backbone.js L39
if (!_ && (typeof require !== 'undefined')) _ = require('underscore');
View templatejs.js
// TemplateJS v3.1.1 MIT/GPL2 @jon_neal
(function (global) {
function escapeJS (str) {
return str.replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r');
}
function TemplateWalk (instance, str) {
// check for the opening and closer strings
var indexOpener = str.indexOf(instance.chars.open);
var indexCloser = str.indexOf(instance.chars.close);
@tbranyen
tbranyen / application.js
Created Nov 13, 2011 — forked from iros/application.js
BackboneTraining-require.js
View application.js
// Define whatever global space vars you might need.
var mbta = {
// application configuration parameters
app : {
server : "http://backbonetraining.bocoup.com:8000"
},
// application data
data : {
// station collection
lines : null
View gist:1017588
// Initially zero. When decremented to zero, fires callback
function semaphore( callback ) {
var fn = callback,
count = 0;
return {
increment: function() {
count++;
},
decrement: function() {
if( count > 0 ) {
You can’t perform that action at this time.