Skip to content

Instantly share code, notes, and snippets.

View adarsh's full-sized avatar

Adarsh Pandit adarsh

View GitHub Profile
@tommeier
tommeier / core_extensions.rb
Created December 15, 2011 00:38
Add methods for Hash to deep_stringify_keys or deep_symbolize_keys
#Load in rails via:
# config/initializers/core_extensions.rb
#Forcibly require our core extensions after rails has loaded
Dir.glob(Rails.root.join('lib', 'core_ext', '*.rb')).each { |extension| require extension }
@joshuaclayton
joshuaclayton / .rspec
Created January 31, 2012 14:04
RSpec + Cucumber + Spork
--colour --drb
@fnichol
fnichol / README.md
Created February 26, 2012 01:23
A Common .ruby-version File For Ruby Projects

A Common .ruby-version File For Ruby Projects

Background

I've been using this technique in most of my Ruby projects lately where Ruby versions are required:

  • Create .rbenv-version containing the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far...
  • Create .rvmrc (with rvm --create --rvmrc "1.9.3@myapp") and edit the environment_id= line to fetch the Ruby version from .rbenv-version (example below).

Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version.

@harlow
harlow / capybara_example.rb
Created February 26, 2012 18:58
Capybara Cheat Sheet
# Navigating
visit('/projects')
visit(post_comments_path(post))
# Clicking links and buttons
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@croaky
croaky / developer_trail_maps.md
Created March 23, 2012 14:42
A trail map shows different paths someone can take. Everyone starts at different places and wants to go different places. Pick the ones that make sense for you.

Structure

  • Have a breakable toy side Rails project. It anchors your learning. Apply new skills/techniques here.
  • Put the code in Github. Give mentors access to the project. They'll review your code.
  • Understand the code review process and other style guidelines.
  • Deploy your breakable toy to Heroku.
  • Set learning goals weekly (e.g. X chapters of the Pickaxe, X Railscasts/week).
  • Keep a text document (using vim) to record interesting commands/concepts/things you've learned.
  • Review the text document daily for comprehension.
#!/usr/bin/env ruby
require 'open-uri'
require 'nokogiri'
require 'json'
class Repo
def initialize(name)
@name = name
end
@harlow
harlow / gist:2510198
Created April 27, 2012 15:32
Gitsucker
#!/usr/bin/env ruby
require 'open-uri'
require 'nokogiri'
require 'json'
class Repo
def initialize(name)
@name = name
end
@gfontenot
gfontenot / alfred-vim.applescript
Created September 6, 2012 19:21
Alfred plugin for editing the selected item in Vim (using iTerm 2)
on alfred_script(q)
set {the_path, file_name} to parse_path(first item of q)
tell application "iTerm"
set _terminal to make new terminal
tell _terminal
launch session "Vim"
tell the last session
write text "cd \"" & the_path & "\""
# Replace e with your vim command
@jessieay
jessieay / git
Created October 3, 2012 18:55
thoughtbot Git Process
BEFORE: start trajectory story
* run specific tests wrote (eg: rspec spec/decorators/event_decorator_spec.rb:5)
rake
git status
git diff
@jfirebaugh
jfirebaugh / gist:4007524
Created November 3, 2012 14:26
Installing Ruby 2.0.0-preview1 with RVM on OS X
# First, make sure that you have the most recent rvm. Several bugs with 2.0.0-preview1
# have recently been fixed.
#
# Second, the openssl that comes with MacOS is too old for Ruby 2.0. You need to install
# a newer one with homebrew or the rvm pkg command.
# Option 1, with homebrew openssl:
brew update
brew install openssl