This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .___.__ | |
# __| _/|__| ____ ____ | |
# / __ | | |/ \ / ___\ | |
# / /_/ | | | | \/ /_/ > | |
# \____ | |__|___| /\___ / | |
# \/ \//_____/ | |
# | |
# Make a "ding" sound on your Mac! Useful for notifying you when a command | |
# line script has finished. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
dry_run = ARGV.delete('--dry-run') | |
force = ARGV.delete('--force') | |
if ARGV.empty? | |
puts <<-USAGE | |
minify, swiftly concat and minify JavaScript files from the command line | |
Pass a single argument to create a .min.js version: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test/unit' | |
require 'rubygems' | |
require 'mocha' | |
class Foo | |
def self.say_hello_to(name) | |
Bar.hello(name) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
if [ $# -eq 0 ]; then | |
cat <<USAGE | |
Convert multiple media files to MP3 and add them to iTunes in one line. | |
Usage: | |
$ 2mp3 list of files to convert | |
USAGE | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////// | |
// IN CONSOLE // | |
//////////////// | |
Blah = Model("blah", { | |
persistence: Model.localStorage(), | |
find_by_uid: function(uid) { | |
return this.detect(function() { | |
return this.uid == uid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Repo | |
REPOS = %w( | |
benpickles/js-model | |
benpickles/peity | |
ismasan/hash_mapper | |
ismasan/jbundle | |
markevans/dragonfly | |
mloughran/api_cache | |
mloughran/em-hiredis | |
mloughran/juggler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Peity events example</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> | |
<script src="http://benpickles.github.com/peity/jquery.peity.js"></script> | |
<script> | |
// Apply Peity once. | |
$(function() { | |
$("#pie").peity("pie") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Activity = Model("activity", function() { | |
this.persistence(Model.REST, "/activity"); | |
this.unique_key = '_id'; | |
}); | |
$(function() { | |
Activity.load(function() { | |
console.log(Activity.all()) | |
var one_activity = Activity.find('fa7043e52b644cd3a7a2217edc0e8928'); | |
console.log(one_activity) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Thankyou Bartosz Blimke! | |
# https://twitter.com/bartoszblimke/status/198391214247124993 | |
module LastRequest | |
def last_request | |
@last_request | |
end | |
def last_request=(request_signature) | |
@last_request = request_signature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function($) { | |
var NONBLANK = /\S/ | |
var SPLITTER = /[^a-z0-9-]+/i | |
function countWords(string) { | |
var trimmed = string.replace(/^\s+|\s+$/g, "") | |
if (NONBLANK.test(trimmed)) { | |
return trimmed.split(SPLITTER).length | |
} else { |