Skip to content

Instantly share code, notes, and snippets.

View ybakos's full-sized avatar
💭
the machine stops the machine stops the machine stops

Yong Joseph Bakos ybakos

💭
the machine stops the machine stops the machine stops
View GitHub Profile

#Dr StrangeCode or "How I Learned to Stop Worrying and Love the Rails 3.0 Upgrade"* I recently upgraded one of my Rails applications from 2.3.5 to 3.0.0 (and from ruby 1.8.7 to 1.9.2). I took a series of notes of all the problems and issues I ran into. ##Ruby 1.8.7 to 1.9.2 upgrade

  • FasterCSV is part of 1.9.2, but not 1.8.7. If you want to maintain compatibility with both, then keep using FasterCSV.
  • ftools no longer exists in ruby 1.9.2. Was using it in a require. I just used fileutils instead.
  • I had a bunch of old-style case/when statements that no longer work in 1.9.
    hours = case r[6..6]
        when "M": [0,11]
 when "A": [12, 18]
@ybakos
ybakos / gist:1253612
Created September 30, 2011 12:28
my terminator gem error
terminator-0.4.4/lib/terminator.rb:127:in `block in terminate': wrong number of arguments (1 for 0) (ArgumentError)
from /Users/ybakos/projects/261/csci261_grading_toolkit/final/lib/09_bottles/submission.rb:40:in `call'
from /Users/ybakos/projects/261/csci261_grading_toolkit/final/lib/09_bottles/submission.rb:40:in ``'
from /Users/ybakos/projects/261/csci261_grading_toolkit/final/lib/09_bottles/submission.rb:40:in `block in incorporates_user_choice_of_product'
from /Users/ybakos/.rvm/gems/ruby-1.9.2-p180@grading/gems/terminator-0.4.4/lib/terminator.rb:134:in `call'
from /Users/ybakos/.rvm/gems/ruby-1.9.2-p180@grading/gems/terminator-0.4.4/lib/terminator.rb:134:in `terminate'
from /Users/ybakos/projects/261/csci261_grading_toolkit/final/lib/09_bottles/submission.rb:38:in `incorporates_user_choice_of_product'
@cspickert
cspickert / Search Xcode Documentation.applescript
Created April 26, 2012 16:36
Jump to the documentation search field in Xcode 4 using AppleScript.
#!/usr/bin/osascript
-- Jump to the documentation search field in Xcode 4's Organizer
-- To use, make sure "Enable access for assistive devices" is enabled in the Universal Access pref pane
tell application "System Events"
tell process "Xcode"
-- Activate Xcode if necessary
set frontmost to true
@elgalu
elgalu / Ruby.tmLanguage
Created October 20, 2012 00:54
Sublime Text - Adding ruby regular expression detection starting and ending with slashes
<!-- elgalu: Adding ruby regular expression detection starting and ending with slashes -->
<dict>
<key>begin</key>
<string>/</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.ruby</string>
anonymous
anonymous / gist:4271964
Created December 12, 2012 21:52
run this in your terminal (mac/linux). via http://www.reddit.com/r/gifs/comments/14p3ip/snowing_cli_style/
clear; while :; do echo $LINES $COLUMNS $(($RANDOM%$COLUMNS)); sleep 0.1; done | awk '{a[$3]=0; for(x in a) {o=a[x]; a[x]=a[x]+1; printf "\033[%s;%sH ",o,x; printf "\033[%s;%sH*\033[0;0H",a[x],x;}}'
@ybakos
ybakos / gist:4956672
Created February 14, 2013 21:43
Append pull request to an existing issue.
hub pull-request -i 1 -b ORIGINAL_AUTHOR:master -h YOUR_USER_NAME:my-changes
@michaelfeathers
michaelfeathers / dentdetect.rb
Last active December 16, 2015 07:08
Attempt to discern number of spaces used for an indent across a set of source files.
class Array
def freq_by &block
group_by(&block).map {|k,v| [k, v.count] }.sort_by(&:first)
end
def freq
freq_by {|e| e }
end
end
@ybakos
ybakos / osx-for-hackers.sh
Created January 7, 2016 04:47 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@aslakhellesoy
aslakhellesoy / gfm.sh
Last active November 23, 2016 09:57
Compile and show GFM docs in your browser.https://help.github.com/articles/github-flavored-markdown
#!/bin/sh
# Compile and show [GFM](https://help.github.com/articles/github-flavored-markdown) docs in your browser.
# Before this works you need to `gem install bcat`
#
# Usage: gfm.sh FILE.md
#
curl --silent --data-binary @- https://api.github.com/markdown/raw -H "Content-Type: text/plain" | bcat
@ryanb
ryanb / rails_3_1_rc4_changes.md
Created May 6, 2011 01:10
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]