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
# I got this idea from http://mihai.bazon.net/blog/redis-client-library-javascript-node | |
# The technique relies on the fact that raising an exception clears the call stack. | |
# The context is passed along with a block attached to an exception. | |
# I thought it was brilliant js hackery so I decided to try my hand at it in ruby. | |
# I've also included some other stack-dependent implementations. | |
# straight recursion, not quite a tail-call | |
# I can't go above 8.1k without stack error | |
def rsum(num) | |
if num == 0 |
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
mail() { | |
if [[ $1 = "p" ]]; then | |
rvm system exec vmail -c ~/.vmailrc-p | |
elif [[ $1 = "w" ]]; then | |
rvm system exec vmail -c ~/.vmailrc-w | |
else | |
echo "Please specify an account." | |
fi | |
} |
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 ruby1.8 | |
## | |
# File: contactos.rb | |
# Author: Horacio Sanson (hsanson at gmail) | |
# Date: 2010/01/22 | |
# | |
# Descr: | |
# Small script to facilitate use of GMail contacts within mutt email client. | |
# | |
# Features: |
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
/* | |
* Grooveshark HTML5 Audio Injector for Flash-less browsers | |
* <https://gist.github.com/gists/779895> | |
* Version 0.0.8 | |
* | |
* To use, simply copy and paste this code into the Developer Console | |
* for the open Grooveshark page and hit enter. Only tested with Google Chrome. | |
* | |
* Porting to Javascript Copyright (C) 2011 Adam Malcontenti-Wilson <adman.com@gmail.com> | |
* All other elements Copyright (C) Escape Media Group ("Grooveshark") |
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
#!/bin/bash | |
# USAGE: /path/to/chrometest <localfile.html> | |
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \ | |
--disable-web-security \ | |
--allow-file-access-from-files \ | |
--allow-file-access \ | |
--log-level 3 \ | |
$@ |
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
# | |
# Datastore.rb | |
# A singleton class to manage a MacRuby application's data storage requirements. | |
# | |
# Chris Powell, cpowell@prylis.com, http://cbpowell.wordpress.com | |
# | |
# This work is licensed under a Creative Commons Attribution 3.0 Unported License. | |
# http://creativecommons.org/licenses/by/3.0/ | |
# | |
# For usage and discussion, see http://cbpowell.wordpress.com/category/macruby/ |
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 FormHelper | |
attr_accessor :form | |
def initialize(nsform=nil) | |
@form = nsform | |
end | |
def length | |
form.numberOfRows | |
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
# coding: utf-8 | |
Earthquake.init do | |
output do |item| | |
if item["_stream"] && item["text"] | |
notify item["text"], title: "#{item["user"]["name"]} (#{item["user"]["screen_name"]})" | |
end | |
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
#!/bin/bash | |
ruby -I/usr/local/Library/Homebrew -rglobal -rkeg -e 'k = Keg.new("/usr/local/Cellar/#{pkg}/#{version}"); puts k.unlink; k.uninstall' |
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
module Oink | |
class Doink | |
end | |
end | |
> Kernel.const_get("Oink::Doink") | |
NameError: wrong constant name Oink::Doink | |
> Kernel.const_get("Oink").const_get("Doink") | |
=> Oink::Doink |