Skip to content

Instantly share code, notes, and snippets.

View cadorn's full-sized avatar

C Dorn cadorn

View GitHub Profile
@rcoup
rcoup / aws_usage.py
Created June 1, 2010 21:46
A script to query the Amazon Web Services (S3/EC2/etc) usage reports programmatically.
#!/usr/bin/env python
"""
A script to query the Amazon Web Services usage reports programmatically.
Ideally this wouldn't exist, and Amazon would provide an API we can use
instead, but hey - that's life.
Basically takes your AWS account username and password, logs into the
website as you, and grabs the data out. Always gets the 'All Usage Types'
@jehiah
jehiah / simple_args_parsing.sh
Created March 4, 2011 16:56
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@stellaraccident
stellaraccident / control-block-http-example1.js
Created March 21, 2011 20:05
Bulletproof node coding snippets
request: function(options) {
var future=new Future();
var req=http.request(options, function(res) {
var text='';
res.setEncoding('utf8');
res.on('data', function(chunk) {
text+=chunk;
});
res.on('end', Block.guard(function() {
@guybrush
guybrush / nodeconf_2011.md
Created May 6, 2011 07:22
a list of slides from nodeconf 2011
@140bytes
140bytes / LICENSE.txt
Created May 9, 2011 16:13
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@tlrobinson
tlrobinson / better-twitter.js
Created May 27, 2011 23:17
Hack to make NewTwitter use HTML5 pushState instead of annoying hash fragments.
twttr.secrets.html5Routing = true;
twttr.router._changeUrlAndCallAction = function(p) {
return twttr.Router.prototype._changeUrlAndCallAction.call(this, p.replace("#!/", ""));
}
twttr.router._changeUrlAndCallAction(window.location.hash);
@akiellor
akiellor / main.js
Created November 14, 2011 02:19
CommonJS implementation of Polyglot for Rhino.
var polyglot = require('polyglot');
polyglot.register('coffee', require('coffee-script').CoffeeScript.compile);
polyglot.require('math').square(2);
@domenic
domenic / gist:1370488
Created November 16, 2011 16:08
Discussion of AMD vs. CommonJS Modules/2.0

Just want to chime in that I'm glad people are still interested in CommonJS Modules/2.0. We have a working implementation that hopefully will be of interest, and have factored out the generally applicable parts of our test suite. Also see the announcement thread on the CommonJS list.

That said, personally I've been a bit disappointed with the CommonJS community's lack of enthusiasm on Modules/2.0. We picked it up early in our project lifecycle, and ran with it full speed. At the time it seemed like a more standardized alternative to AMD.

However, over time it's become clear that AMD has not only won mindshare but also has a much more active group of maintainers and a better, more egalitarian standards process. Whereas, Modules/2.0 has only the perennially busy Wes Garland, leaving a self-hosted PDF s

@kriskowal
kriskowal / module-proposal-diffs.md
Created December 9, 2011 18:43
(Un)CommonJS Asynchronous Module Proposal Differences

In both cases below, ID is the exports object of the "id" module.

require.ensure(["id"], function (require) {
    var ID = require("id");
})
@domenic
domenic / README.md
Last active June 24, 2021 16:37
Using promises in a UI context

The scenario:

  • We are writing a digital textbook-reading app.
  • Most of the time you have a "basic" license for your textbook, but one (and only one) of your computers can request an "enhanced" license.
  • You can only print from the computer with the enhanced license.

The problem statement: