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
Shim::Engine.routes.draw do | |
match "*id" => 'pages#show', :as => :page, :format => false | |
root :to => 'pages#show', :id => "index" | |
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
$ -> | |
$("#nav-main li").click -> | |
toExpand = $ $(this).data("expand") | |
$(".nav-sub").hide() | |
toExpand.show() | |
if $(this).hasClass("open") | |
$("#nav-sub-group").height(0) unless $(this).siblings().hasClass("open") | |
$("#nav-main li").removeClass("open") |
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 Stuff | |
def some_method | |
# stuff... | |
end | |
rescue Exception => ex | |
# Deal with ex here... | |
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
require 'json' | |
require 'csv' | |
require 'pry' | |
data = JSON.parse(DATA.read) | |
CSV.open 'data.csv', 'wb' do |csv| | |
mapping = { | |
"name" => "custom_field_1", | |
"email" => "custom_field_4", | |
"phone" => "custom_field_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
if params[:q] | |
attrs = { | |
id: 0, | |
business_partner_id: 1, | |
street_number: params[:q]['near_filter(1)'], | |
city: params[:q]['near_filter(2)'], | |
state: params[:q]['near_filter(3)'], | |
zip_code: params[:q]['near_filter(4)'], | |
icon_name: "home" | |
} |
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
http://nodejs.org | |
http://search.npmjs.org/ | |
https://github.com/dannycoates/node-inspector | |
Terminal: | |
brew install node | |
brew install npm | |
Those little guys will make for a beefy compile process, make sure you're plugged in. building the V8 engine from source can take some time. |
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
Make a keyboard shortcut to run a shell script with Alfred or Quicksilver, and point it at | |
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend |
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
# Path to your oh-my-zsh configuration. | |
ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="half-life" | |
# Set to this to use case-sensitive completion |
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
return $('table#product_stats a').live('ajax:success', function(xhr, response, status) { | |
var row; | |
return row = $(this); | |
}); |
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
# Using #collect in this example makes more sense in my head, because it's kinda like Array#join | |
twitter.user_timeline('cwoodcox').tweets.collect do |tweet| | |
"#{tweet.username}: \" #{tweet.text}\"" | |
end | |
# Using #map in this context makes more sense in my head, since we're operating on every element | |
my_stats_array.map do |stat| | |
stat * 2 | |
end |