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
# First install libxslt and libxml2 using Homebrew | |
brew install libxslt | |
brew install libxml2 | |
# Now rebuild nokogiri with these new libs (make sure to update version numbers if your homebrew installed a different version) | |
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26/ | |
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
OmniAuth.config.on_failure = -> env do | |
env[ActionDispatch::Flash::KEY] ||= ActionDispatch::Flash::FlashHash.new | |
env[ActionDispatch::Flash::KEY][:error] = "Either your email or password was not recognised. Please try again." | |
SessionsController.action(:new).call(env) #call whatever controller/action that displays your signup form | |
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
<div class="field"> | |
<%= label_tag :conditions %><br> | |
<%= check_box_tag :conditions %> | |
</div> |
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
class Identity < OmniAuth::Identity::Models::ActiveRecord | |
... | |
validates :conditions, acceptance: true, allow_nil: false, on: :create | |
attr_accessor :conditions | |
... | |
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
Rails.application.config.middleware.use OmniAuth::Builder do | |
provider :identity, fields: [:email, :conditions] | |
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
git mv readme.md readme.md.temp | |
git mv readme.md.temp README.md |
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
def namedObjectsNear(lat: Double, long: Double): Seq[Venue] = { | |
def call(lat: Double, long: Double, distances: List[Int]): Seq[Venue] = { | |
var res = List[Venue]() | |
var remainingDistances = distances | |
while (distance.tail.size != 0 && res.size <= 20) | |
res = API.getResults(lat, long, distance) | |
remainingDistances = remainingDistances.tail | |
res | |
} |
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
RSpec.configure do |config| | |
config.after(:all) do | |
# do something | |
end | |
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 'bloomfilter' | |
bf = BloomFilter.new({ 'bits' => 0xff, 'salts' => %w(z A) }) | |
bf.add("foo") | |
bf.test("foo") | |
#=> true | |
bf.to_json |
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
stage { 'preinstall': | |
before => Stage['main'] | |
} | |
class apt_get_update { | |
exec { 'apt-get -y update': } | |
} | |
class { 'apt_get_update': | |
stage => preinstall |
OlderNewer