Skip to content

Instantly share code, notes, and snippets.

Dan Webb danwrong

Block or report user

Report or block danwrong

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 loadrunner.js
(function loadrunner(e){var w=e.document;var h=w.getElementsByTagName("script"),n,k;var B={},j={},v;for(var z=0,r;r=h[z];z++){if(r.src.match(/loadrunner\.js(\?|#|$)/)){n=r;break}}function c(i){if(i.length>0){return i.replace(/\/$/,"")+"/"}return""}function o(i){return Array.prototype.slice.call(i)}function b(s,E){for(var F=0,G;G=s[F];F++){if(E==G){return F}}return -1}function t(i){return !!i.match(/^(([a-zA-Z0-9\-_]+)\/)*[a-zA-Z0-9\-_]+$/)}function q(i){return[c(y.path),i,".js"].join("")}function d(i){if(i.match(/^(https?)?:?\/\//)){return i}if(i.match(/^\/[^\/]/)){return c(y.docRoot)+i}if(i.match(/^\$/)){return c(y.path)+i.replace(/^\$/,"")}return i}function p(s){var i;if(i=j[s]){return i}else{return s}}function f(){}f.prototype.addCallback=function(i){if(this.completed){i.apply(this,this.results)}else{this.callbacks=this.callbacks||[];this.callbacks.push(i)}};f.prototype.complete=function(){if(!this.completed){this.results=o(arguments);this.completed=true;if(this.callbacks){for(var E=0,s;s=this.callbacks[E]
View exhibit A.js
var args= "";
for(var i=0;i<argument_pairs.length;i++) {
args+= argument_pairs[i][0];
args+= "="
args+= argument_pairs[i][1];
if( i < argument_pairs.length-1 ) args+= "&";
}
return args;
View gist:596165
About to start a silent teatime demo. Follow @danwrong if you want to play along.
R E T W E E T if you've got a beer in hand!
"Extraordinary is taking a simple idea and revolutionizing it in a way that changes the world." http://twitpic.com/2rl85p
Surely that deserves a favorite!!
Have any questions? DM me.
View gist:473487
function DropDownMenu(element) {
element.addEventListener('mouseover mouseout', this, false);
}
DropDownMenu.prototype = {
handleEvent: function(e) {
switch(e.type) {
'mouseover': this.open(e); break;
'mouseout': this.close(e); break;
}
View gist:418863
require 'rubygems'
require 'twitter'
oauth = Twitter::OAuth.new('ctoken', 'csecret')
oauth.authorize_from_access('atoken', 'asecret')
twitter = Twitter::Base.new(oauth)
annotations = [
{:coffee => {:temperature => "hot", :effectiveness => "crack"}},
{:music => {
@danwrong
danwrong / 10
Created Mar 21, 2010
Twitter DJ Set Tracklist
View 10
Power Lunch - Har Mar Superstar
Chemical Beats (Dave Clarke Remix) - Chemical Brothers
When You Hear The Bassline - Major Lazer
Hey (Black Noise Remix) - Laidback Luke/Diplo
Chainsaw Calligraphy (Propatingz Crunk Massacre Remix) - 16 Bit
Breathe (Number9nine Remix) - The Prodigy
Alert - Liquid Stranger
Technophobe - N-Type & The Others
Explicit - Emalkay
Bow E3 - Wiley
View dombuilder.jquery.js
// DOM Builder plugin for jQuery
// (c) Dan Webb (dan@massiverobot.co.uk)
//
// $.build(function() {
//
// div({ 'class': 'module' },
// h1('A list of stuff'),
// ul(
// li('item 1'),
// li('item 2'),
View validation_reflection.rb
def mandatory?(method)
if @object.class.respond_to? :reflect_on_validations_for
@object.class.reflect_on_validations_for(method).any? { |val| val.macro == :validates_presence_of }
end
end
View ejs.jquery.js
// ERB style templates for jQuery in hardly any code.
//
// Based on http://ejohn.org/blog/javascript-micro-templating/
//
// A tiny and simple plugin to allow erb style template rendering within jQuery.
//
// Make a template:
//
// <script type="text/html" id="template1">
// <% $.each(items, function(i, image) { %>
View gist:199146
jQuery(function($) {
if (typeof $.keys != 'function') {
$.extend({
keys: function(obj) {
var a = [];
$.each(obj, function(k){ a.push(k) });
return a;
}
});
}
You can’t perform that action at this time.