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
require "test/unit" | |
class TestFizzBuzz < Test::Unit::TestCase | |
def fizzbuzz(x) | |
"#{'Fizz' if x % 3 == 0}#{'Buzz' if x % 5 == 0}" | |
end | |
def test_equal | |
assert_equal fizzbuzz(3), "Fizz" | |
assert_equal fizzbuzz(50), "Buzz" |
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
[2012-04-10 09:02:35] autoreconf | |
Can't exec "aclocal": No such file or directory at /Users/millsb/.rvm/usr/share/autoconf/Autom4te/FileUtils.pm line 325. | |
autoreconf: failed to run aclocal: No such file or directory |
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
- (void)viewWillDisappear:(BOOL)animated { | |
NSArray *viewControllers = self.navigationController.viewControllers; | |
if (viewControllers.count > 1 && [viewControllers objectAtIndex:viewControllers.count-2] == self) { | |
// View is disappearing because a new view controller was pushed onto the stack | |
NSLog(@"New view controller was pushed"); | |
} else if ([viewControllers indexOfObject:self] == NSNotFound) { | |
// View is disappearing because it was popped from the stack | |
NSLog(@"View controller was popped"); | |
} | |
} |
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
from tkinter import * | |
from tkinter import ttk | |
def calculate(*args): | |
try: | |
value = float(feet.get()) | |
meters.set((0.3048 * value * 10000.0 + 0.5)/10000.0) | |
except ValueError: | |
pass | |
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
#!/bin/bash | |
set -u | |
set -e | |
#change this below to your actual path. If you another environemnt like staging, fucking change N to -e staging instead. | |
APP_PATH=/youpath/to/app/root | |
PID=$APP_PATH/tmp/pids/unicorn.pid | |
OLD_PID=$APP_PATH/tmp/pids/unicorn.pid.oldbin | |
UNICORN_COMMAND="unicorn_rails -c $APP_PATH/config/unicorn.rb -D" | |
while getopts ":nsNr" opt; do |
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 you're getting this error trying to use ApacheBench on OS X Lion: | |
# Benchmarking mwmanning.com (be patient)...apr_socket_recv: Connection reset by peer (54) | |
# | |
# You need to download the latest beta version of Apache and rebuild ab. | |
# Here's how (assuming you have homebrew installed). | |
# Install Homebrew (https://github.com/mxcl/homebrew) and then the Perl Regex support | |
brew install pcre | |
# Download the latest from http://httpd.apache.org/download.cgi, then decompress and compile it |
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
#!/usr/local/bin/macruby | |
framework 'Cocoa' | |
framework 'QuartzCore' | |
class FireworkDelegate | |
attr_accessor :window | |
def initWithURL(url) | |
case url | |
when String | |
@firework_photo_url = NSURL.URLWithString(url) |
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
Removing /Users/millsb/.rvm/src/ruby-1.9.2-head... | |
it seems that /Users/millsb/.rvm/rubies/ruby-1.9.2-head is already non existent. | |
Removing ruby-1.9.2-head aliases... | |
Removing ruby-1.9.2-head wrappers... | |
Removing ruby-1.9.2-head environments... | |
Removing ruby-1.9.2-head binaries... | |
Installing Ruby from source to: /Users/millsb/.rvm/rubies/ruby-1.9.2-head, this may take a while depending on your cpu(s)... | |
ruby-1.9.2-head - #fetching | |
HEAD is now at 8b75c2f * doc/ChangeLog-1.9.3, test/gdbm/test_gdbm.rb: fixed mingw typo. |
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
Installing Ruby from source to: /Users/millsb/.rvm/rubies/ruby-1.9.2-head, this may take a while depending on your cpu(s)... | |
ruby-1.9.2-head - #fetching | |
HEAD is now at 8b75c2f * doc/ChangeLog-1.9.3, test/gdbm/test_gdbm.rb: fixed mingw typo. | |
From git://github.com/ruby/ruby | |
* branch ruby_1_9_2 -> FETCH_HEAD | |
Already up-to-date. | |
Copying from repo to src path... | |
Applying patch '/Users/millsb/.rvm/patches/ruby/fix-irb-completion.diff' (located at //Users/millsb/.rvm/patches/ruby/fix-irb-completion.diff) | |
ERROR: Error running 'patch -F 25 -p1 -N -f <"//Users/millsb/.rvm/patches/ruby/fix-irb-completion.diff"', please read /Users/millsb/.rvm/log/ruby-1.9.2-head/patch.apply.fix-irb-completion.diff.log |
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
+ [[ -n '' ]] | |
+ export 'PS4=+ ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > ' | |
+ PS4='+ ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > ' | |
+ /scripts/cli : __rvm_parse_args() 746 > [[ -z '' ]] | |
+ /scripts/cli : __rvm_parse_args() 746 > [[ -n '' ]] | |
+ /scripts/cli : __rvm_parse_args() 748 > [[ 0 -eq 1 ]] | |
+ /scripts/cli : __rvm_parse_args() 748 > [[ -n '' ]] | |
+ /scripts/cli : __rvm_parse_args() 19 > [[ -n install ]] | |
+ /scripts/cli : __rvm_parse_args() 21 > rvm_token=install | |
+ /scripts/cli : __rvm_parse_args() 23 > (( 8 > 0 )) |