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 [ | |
| #data | |
| 'models/options' | |
| 'models/ui' | |
| #thin models | |
| 'models/optionsOptions' | |
| 'models/optionsClubHead' | |
| 'models/optionsGrip' | |
| 'models/optionsShaft' | |
| 'models/optionsLengthWrap' |
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
| task :foo do | |
| puts "bar" | |
| end | |
| task :foo do | |
| puts "baz" | |
| end | |
| rake foo | |
| #=> "bar" |
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
| # shell | |
| mkfifo mypipe | |
| # ruby | |
| open('mypipe', 'r+b'){ |f| puts f.gets(nil) } | |
| # shell |
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
| (ns bit-sandbox.core) | |
| ; helper | |
| (defn shifted-byte [int-byte-value, shift-by] | |
| (bit-shift-left | |
| (bit-and int-byte-value 0xFF) | |
| (* shift-by 8))) | |
| ; (+ meat potatoes) |
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
| validClickElementCallbacks: [ | |
| (el) -> $(el)[0].tagName.match(/li/i) && $(el)[0].className.match(/day/), | |
| (el) -> $(el)[0].tagName.match(/span/i) && $(el)[0].className.match(/remaining/), | |
| (el) -> $(el)[0].tagName.match(/h3/i) | |
| ] | |
| bindEvents: -> | |
| @element.click (e) => | |
| return unless _.any(@validClickElementCallbacks, (fn) -> fn(e.target)) |
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
| it 'creates a participant after clicking `confirm' do | |
| load_page | |
| click_on '10:00 am' | |
| # Not sure why the ActiveRecord connection is becoming | |
| # stale...probably something to do with the way capybara runs tests | |
| # with selenium. | |
| # | |
| # Symptom that led to the change: | |
| # Running this in isolation without refreshing the connection would |
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
| def try_cached_event | |
| unless (id = cookies[Event::IDENTITY_KEY]) && (event = Event.find_by_id(id)) | |
| cookies[Event::IDENTITY_KEY] = { expires: 1.day.ago } | |
| return | |
| end | |
| redirect_to event_participants_url(event) | |
| 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
| # Gets the last gist for specified user | |
| # | |
| # last gist [for] <username> - Returns the last gist for specified user | |
| module.exports = (robot) -> | |
| robot.respond /last gist (?:for)? (.+)/i, (msg) -> | |
| username = msg.match[1] | |
| url = "https://api.github.com/users/#{username}/gists" | |
| msg.http(url).get() (err, res, body) -> | |
| gists = JSON.parse(body) | |
| indexed = {} |
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(listcomp). | |
| -export([perms/1]). | |
| % generates all possible letter permutations given a string of letters | |
| perms( [] ) -> [[]]; | |
| perms(Phrase) -> | |
| [ [H|Rest] || | |
| H <- Phrase, | |
| Rest <- perms(Phrase -- [H])]. |
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 Hash | |
| def symbolize_keys | |
| replace( keys.inject({}) { |new_hash,key| new_hash[key.to_sym] = self[key]; new_hash } ) | |
| end | |
| def symbolize_keys! | |
| symbolized_hash = keys.inject({}) do |new_hash,key| | |
| new_hash[key.to_sym] = self[key] | |
| new_hash[key.to_sym].symbolize_keys! if new_hash[key.to_sym].respond_to? :symbolize_keys! | |
| new_hash |