Skip to content

Instantly share code, notes, and snippets.

View netbe's full-sized avatar

François Benaiteau netbe

View GitHub Profile
file 'config/preinitializer.rb', <<-PRE
# Use bundled gems
begin
require File.expand_path('../../.bundle/environment', __FILE__)
rescue LoadError
# This setup deliberately requires that the application be locked.
# For an alternative, see http://gist.github.com/302406#file_preinitializer.rb
if File.exist?(File.expand_path('../../Gemfile.lock', __FILE__))
raise "Application is locked but not installed. Run `bundle install` and then try again."
else
@netbe
netbe / brunch_deploy.sh
Created June 8, 2012 14:39
Script to deploy brunch build to gh-pages
#!/bin/bash
if [ $# -lt 4 ]
then
branch='gh-pages'
else
branch=$4
fi
if [ $# -lt 3 ]
@netbe
netbe / template.sublime-project
Created June 19, 2012 18:37
sublime 2 text project template (exclude directories)
{
"folders":
[
{
"path": ".",
"folder_exclude_patterns": ["log", "script", "tmp", "doc", "coverage"],
"file_exclude_patterns": ["*bak", "*~"]
}
],
@netbe
netbe / extract_fixtures.rake
Created June 28, 2012 13:16
Extract db tables to fixtures file
namespace :db do
desc 'Create YAML test fixtures from data in an existing database.
Defaults to development database. Set RAILS_ENV to override.'
task :extract_fixtures => :environment do
sql = "SELECT * FROM %s"
skip_tables = ["schema_migrations", "sessions"]
ActiveRecord::Base.establish_connection
tables = ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : ActiveRecord::Base.connection.tables - skip_tables
tables.each do |table_name|
@netbe
netbe / .pryrc
Created July 5, 2012 13:26 — forked from olivierlacan/.pryrc
Pry configuraton
# switch default editor for pry to sublime text
Pry.config.editor = "sublime"
# format prompt to be <Rails version>@<ruby version>(<object>)>
Pry.config.prompt = proc do |obj, level, _|
prompt = "\e[1;30m"
prompt << "#{Rails.version} @ " if defined?(Rails)
prompt << "#{RUBY_VERSION}"
"#{prompt} (#{obj})>\e[0m"
end
@netbe
netbe / singel_app_mode
Created July 9, 2012 18:47
Command to make single app on mac os x
~% defaults write com.apple.dock single-app -bool true
~% killall Dock
@netbe
netbe / xcode4_theme_commands
Created July 13, 2012 22:00
commnands to install xcode 4 theme
mkdir -p ~/Library/Developer/Xcode/UserData/FontAndColorThemes; cd ~/Library/Developer/Xcode/UserData/FontAndColorThemes; curl -O http://developers.enormego.com/assets/egotheme/EGOv2.dvtcolortheme
@netbe
netbe / test.sh
Created August 2, 2012 08:45
Load Testing
#!/bin/bash
for i in {1..100}
do
echo `curl -X 'OPTIONS' -H 'X-TriviaSports-Token: 62dcae5a5a6efc710391e537cd777fcd' https://triviasports-preproduction.chugulu.com/api/games/start > /dev/null`;
echo `curl -X 'GET' -H 'X-TriviaSports-Token: 62dcae5a5a6efc710391e537cd777fcd' https://triviasports-preproduction.chugulu.com/api/games/start > /dev/null`;
done;
@netbe
netbe / complex_iOS_build_script.sh
Created August 28, 2012 16:59 — forked from abury/complex_iOS_build_script.sh
An extended iOS build Script showing a range of functions
#!/bin/sh
# Extended iOS Build Script
# Written by Aron Bury, 29/11/2011
#==== Script Params =====
# App params
appname="AwesomeApp"
target_name="$appname"
sdk="iphoneos"
@netbe
netbe / define_test_method.rb
Created September 3, 2012 15:52
test declaractive method
def self.test(name)
define_method("test_#{name.gsub(' ', '_').downcase}") do
yield
end
end