This file contains hidden or 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 Time | |
| def within?(time_period) | |
| self >= Time.now && self <= Time.now + time_period | |
| end | |
| end | |
| # >> (Time.now + 55.hours).within? 2.days | |
| # false | |
| # >> (Time.now + 45.hours).within? 2.days | |
| # true |
This file contains hidden or 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
| autodetach on | |
| defkanji euc | |
| deflogin on | |
| startup_message off | |
| defscrollback 100000 | |
| defshell -bash | |
| chdir | |
| term "xterm" | |
| escape ^Tt | |
| encoding UTF-8 UTF-8 |
This file contains hidden or 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
| # test/spec test runner | |
| function ts() | |
| { | |
| ruby $1 -r s 2>/dev/null | grep -v "^HelperTestCase" | grep -v "dummy (e" | |
| } | |
| # test/spec test runner (with test name) | |
| function tsn() | |
| { | |
| ruby $1 -r s -n "/$2/" 2>/dev/null | grep -v "^HelperTestCase" | grep -v "dummy (e" |
This file contains hidden or 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 Thing | |
| @@things = {} | |
| def initialize | |
| @pointer = self.hash | |
| end | |
| def set(x) | |
| @@things[@pointer] = x | |
| end |
This file contains hidden or 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 Enumerable | |
| def how_many_have?(method) | |
| self.select {|x| x.send(method)}.count | |
| end | |
| alias_method :how_many_are?, :how_many_have? | |
| end | |
| # >> [1,2,3,4,5].how_many_are?(:even?) | |
| # => 2 | |
| # |
This file contains hidden or 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 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
| <html xmlns="http://www.w3.org/1999/xhtml" | |
| xmlns:fb="http://www.facebook.com/2008/fbml"> | |
| <head> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
| <title>XFBML Bug</title> | |
| </head> | |
| <body> |
This file contains hidden or 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
| # The irbrc file for Brad Fults <bfults@gmail.com> | |
| # | |
| # Most of the code here came from http://wiki.rubygarden.org/Ruby/page/show/Irb/TipsAndTricks | |
| # | |
| unless self.class.const_defined? "IRB_RC_HAS_LOADED" | |
| HISTFILE = "~/.irb-history" | |
| MAXHISTSIZE = 100 | |
| begin # ANSI codes | |
| ANSI_BLACK = "\033[0;30m" |
This file contains hidden or 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
| if (!Array.prototype.uniq) | |
| { | |
| Array.prototype.uniq = function(fun) | |
| { | |
| var seen = {}; | |
| return this.filter(function (el) { | |
| var key = typeof (fun) == "function" ? fun(el) : el; | |
| var r = !seen[key]; | |
| seen[key] = true; | |
| return r; |
This file contains hidden or 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
| AK | |
| VT NH ME | |
| WA MT ND MN NY MA | |
| WI MI CT RI | |
| OR ID SD IL IN OH PA NJ | |
| MD DE | |
| WY NE IA WV VA DC | |
| CA NV UT CO KS MO KY NC | |
| OK AR TN SC | |
| AZ NM LA MS AL GA |
This file contains hidden or 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
| 08:47:28 [bfults@austin] ~$ rvm info | |
| 1.8: | |
| system: | |
| uname: "Darwin austin 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386" | |
| bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)" | |
| zsh: "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)" | |
| rvm: |
OlderNewer