Skip to content

Instantly share code, notes, and snippets.

Andrew Dupont savetheclocktower

Block or report user

Report or block savetheclocktower

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 gist:174069
// ==UserScript==
// @name Reddit Uppers and Downers
// @namespace mistercow
// @description Show up-votes and down-votes next to the total score on reddit comments.
// @include http://*.reddit.com/*/comments/*
// @include http://reddit.com/*/comments/*
// ==/UserScript==
/*
This code is provided as is, with no warranty of any kind.
View gist:147633
/**
* Krang.deepExtend(destination, source) -> Object
*
* A "deep" version of `Object.extend`. Performs a recursive deep extension.
*
* Used within Krang to blend user-set options with the defaults.
**/
Krang.deepExtend = function(destination, source) {
for (var property in source) {
View gist:114444
Object.extend(Ajax, {
registerURL: function(url, options) {
options = Object.extend({
instancePooling: true,
autoUpdatePlayer: true
}, options || {});
this._registry.set(url, options);
},
View proto-tests.js
window.tests = {
"make" : function(){
var fromcode;
for (var i = 0; i < 250; i++) {
fromcode = new Element('ul');
document.body.appendChild(fromcode);
$w('one two three').each( function(word){
fromcode.appendChild(new Element('li').update(word));
});
View sprockets.markdown

Sprockets: Beautiful and angular

Over at SvN, Sam announced the 1.0 release of Sprockets, the new dependency management and concatenation tool that makes it easy to modularize your JavaScript. Sprockets is Prototype's new build system, but you can use it, too; it's been extracted into a Ruby library so you can use it anywhere you write JavaScript.

There are many great ways to use Sprockets in your own projects. You can use it the way Prototype does — split up your JavaScript into small, maintainable files, then [create "meta-files"](http://github.com/sstephenson/prototype/blob/ab1313ea202e0d0bfb7cd0f563b035040710

View element_storage.js
Element.Storage = {
UID: 1
};
Element.addMethods({
getStorage: function(element) {
if (!(element = $(element))) return;
if (Object.isUndefined(element._prototypeUID))
element._prototypeUID = Element.Storage.UID++;
View gist:36883
require 'rubygems'
require 'css_parser'
require 'hpricot'
require 'open-uri'
def fix_file(html_input_file, css_input_file, html_output_file, css_output_file)
# Instantiate Hpricot doc object
doc = Hpricot(File.read(html_input_file))
parser = CssParser::Parser.new
View gist:24571
Object.extend(NativeObject.prototype, function() {
function computeSomethingWhenAwesomeCapabilityIsAvailable() {
// ...
}
function computeSomethingWhenSomeStupidIEBugIsPresent() {
// ...
}
View gist:19796
From 797e8a43b49fdc26720b1cda80da2735fe724c66 Mon Sep 17 00:00:00 2001
From: Andrew Dupont <prototype@andrewdupont.net>
Date: Sat, 25 Oct 2008 16:16:39 -0500
Subject: [PATCH] Fix links for switching to and downloading themes (they require a POST for security reasons).
---
app/views/admin/themes/_tools.rhtml | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/admin/themes/_tools.rhtml b/app/views/admin/themes/_tools.rhtml
View gist:9696
From 9c8f4bd13483e7eea28a78a7fffffcc5cc337c21 Mon Sep 17 00:00:00 2001
From: Andrew Dupont <prototype@andrewdupont.net>
Date: Tue, 9 Sep 2008 10:38:34 -0500
Subject: [PATCH] Preliminary support for Google Chrome in unit tests.
---
Rakefile | 2 +-
test/lib/jstest.rb | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletions(-)
mode change 100644 => 100755 Rakefile
You can’t perform that action at this time.