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 'benchmark' | |
ActiveRecord::Base.logger = nil | |
ActiveRecord::Schema.verbose = false | |
ActiveRecord::Migration.verbose = false | |
# PARAMS | |
sql = "" | |
attributes = [] |
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
(Benoit Benezech 2014-10-27 16:17:33 +0100 177) it "returns the availability and correct prices" do | |
(Benoit Benezech 2014-10-27 16:17:33 +0100 178) get :extension_availability, id: @rental.id, format: :json, end_date: (@rental.ends_at + 3.days).strftime("%d/%m/%Y"), end_time: "am", distance: '10' | |
(Valentin Rabanelly 2013-06-03 15:51:01 +0200 179) parsed_body = JSON.parse(response.body) | |
(Michael Bensoussan 2014-06-23 11:11:51 +0200 180) expect(parsed_body["availability"]["available"]).to be true | |
(Marc G Gauthier 2013-09-23 12:38:14 +0200 181) expected_message = t("cars.availability.messages.#{status.info}") | |
(Alexandru Keszeg 2013-07-31 18:40:46 +0300 182) expect(parsed_body["availability"]["message"]).to eq(expected_message) | |
(Benoit Benezech 2014-10-27 16:17:33 +0100 183) expect(parsed_body["charges"]["rental_price"]["total"]).to eq(61.1) | |
(Nicolas Mondollot 2013-06-09 16:34:56 +0200 184) 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
remove_project_trailing_whitespace () { | |
for file in * (app|config|test|lib|public)/**/*.(rb|js|sass|css|yml|md|txt|erb|haml|config) | |
do | |
sed -i "" 's/[[:space:]]*$//' ${file} | |
sed -i "" -e :a -e '/^\n*$/N;/\n$/ba' ${file} | |
done | |
} |
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 AppDelegate | |
def application(application, didFinishLaunchingWithOptions:launchOptions) | |
@window = UIWindow.alloc.initWithFrame UIScreen.mainScreen.bounds | |
@window.rootViewController = GoogleViewController.alloc.init | |
@window.makeKeyAndVisible | |
true | |
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
# Disclaimer: this solution has been taken from the post: http://stackoverflow.com/a/5071198/784270 | |
# navigate to the bundler gem and in lib/bundler/runtime.rb, | |
# find the line that does Kernel.require and wrap it like this | |
puts Benchmark.measure("require #{file}") { | |
Kernel.require file | |
}.format("%n: %t %r") | |
# Add |
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
#!/usr/bin/env ruby -wKU | |
require 'rubygems' | |
require 'flickraw' | |
require 'open-uri' | |
require 'fileutils' | |
FlickRaw.api_key = "YOUR_API_KEY" | |
FlickRaw.shared_secret = "YOUR_SHARED_SECRET" |
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
{ | |
"AF": "93", | |
"AL": "355", | |
"DZ": "213", | |
"AD": "376", | |
"AO": "244", | |
"AQ": "672", | |
"AR": "54", | |
"AM": "374", | |
"AW": "297", |
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
#!/usr/bin/env ruby | |
require 'benchmark' | |
REGEXPS = [ | |
/^no such file to load -- (.+)$/i, | |
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, | |
/^Missing API definition file in (.+)$/i, | |
/^cannot load such file -- (.+)$/i, | |
] |
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
sudo aptitude -y install nginx | |
cd /etc/nginx/sites-available | |
sudo rm default | |
sudo cat > jenkins | |
upstream app_server { | |
server 127.0.0.1:8080 fail_timeout=0; | |
} | |
server { | |
listen 80; |
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
#Deploy and rollback on Heroku in staging and production | |
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag'] | |
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag'] | |
namespace :deploy do | |
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU' | |
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU' | |
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag] | |
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on] |
OlderNewer