# Anchor
click_link 'Save'
# Button
click_button 'awesome'
# Both above
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
| ## | |
| # Haversine Distance Calculation | |
| # | |
| # Accepts two coordinates in the form | |
| # of a tuple. I.e. | |
| # geo_a Array(Num, Num) | |
| # geo_b Array(Num, Num) | |
| # miles Boolean | |
| # | |
| # Returns the distance between these two |
This was useful for me when we created a new branch for a new major release, but were still working on our current version as well. I cloned our repo again and kept the new project on our new branch, but also wanted to get my stashes there.
git stash show -p > patch
You'll have to specify your stash and name your file whatevery you want. Do this for as all your stashes, and you'll have patch files in your pwd.
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 valid? version | |
| pattern = /^\d+\.\d+\.\d+(\-(dev|beta|rc\d+))?$/ | |
| raise "Tried to set invalid version: #{version}".red unless version =~ pattern | |
| end | |
| def correct_version version | |
| ver, flag = version.split '-' | |
| v = ver.split '.' | |
| (0..2).each do |n| | |
| v[n] = v[n].to_i |
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
| ############################################################################# | |
| # Migration file to create index so you don't get duplicate users for a group | |
| ############################################################################# | |
| class AddMembersUniquenessIndex < ActiveRecord::Migration | |
| def self.up | |
| add_index :group_members, [:group_id,:user_id], :unique => true | |
| end | |
| def self.down | |
| remove_index :group_members, [:group_id,:user_id] |
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
| *.acn | |
| *.acr | |
| *.alg | |
| *.aux | |
| *.bak | |
| *.bbl | |
| *.bcf | |
| *.blg | |
| *.brf | |
| *.bst |
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
| Warden::Manager.serialize_into_session{|user| user.id } | |
| Warden::Manager.serialize_from_session{|id| User.get(id) } | |
| Warden::Manager.before_failure do |env,opts| | |
| # Sinatra is very sensitive to the request method | |
| # since authentication could fail on any type of method, we need | |
| # to set it for the failure app so it is routed to the correct block | |
| env['REQUEST_METHOD'] = "POST" | |
| end | |
NewerOlder