Skip to content

Instantly share code, notes, and snippets.

View olivierlacan's full-sized avatar

Olivier Lacan olivierlacan

View GitHub Profile
require 'rubygems'
require 'middleman'
run Middleman.server
use Rack::Static,
:urls => ["/stylesheets", "/images"],
:root => "build"
run lambda { |env|
2011-09-15T06:10:35+00:00 heroku[slugc]: Slug compilation finished
2011-09-15T06:10:37+00:00 heroku[web.1]: Starting process with command `thin -p 41476 -e production -R /home/heroku_rack/heroku.ru start`
2011-09-15T06:10:39+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/showexceptions.rb:23:in `rescue in call': undefined method `[]' for #<Rack::Static:0x00000002784cc0> (NoMethodError)
2011-09-15T06:10:39+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/showexceptions.rb:21:in `call'
2011-09-15T06:10:39+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:1272:in `block in call'
2011-09-15T06:10:39+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:1303:in `synchronize'
2011-09-15T06:10:39+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.2.6/lib/sinatra/base.rb:1272:in `call'
2011-09-15T06:10:39+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1
@olivierlacan
olivierlacan / sublime_text_2_coffeescript
Created September 27, 2011 19:16
Add CoffeeScript support to Sublime Text 2 easily
mkdir -p ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/CoffeeScript
cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/CoffeeScript
git clone git://github.com/jashkenas/coffee-script-tmbundle CoffeeScript.tmbundle
@olivierlacan
olivierlacan / prod_env.rb
Created October 13, 2011 14:59
Production env config
Appname::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
@olivierlacan
olivierlacan / .pryrc
Created January 5, 2012 01:16 — forked from renz45/.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
@olivierlacan
olivierlacan / trythis.rb
Created February 2, 2012 21:00
testing tropo
ask "Please enter wicked envy labs conference ID number.", {
:choices => "[5 DIGITS]",
:onChoice => lambda { |event|
if event.choice.interpretation == "12345"
say "Welcome to the ascending conference call."
conference "12345"
say "We hope you had fun, call back soon!"
else
say "This is conference ID is not active."
end
@olivierlacan
olivierlacan / An_example.markdown
Created February 18, 2012 05:40 — forked from renz45/An_example.markdown
Re-style Sublime Text 2 sidebar to a darker theme

This re-styles your sublime text 2 sidebar to be darker, so it doesn't blind you when using a dark theme.

Dark sublime text 2 sidebar

Save the Default.sublime-theme file into packages/Theme - Default, make a backup of your original if you want to be able to go back easily.

@olivierlacan
olivierlacan / 1_before.html.haml
Created June 27, 2012 00:45
The Beauty of Decorators
// Ew, conditional soup
- subscription = current_user.subscription
%p Next bill date:
- if subscription.next_bill_on
%h4= subscription.next_bill_on.to_formatted_s(:long)
- else
%h4 Unknown
- if subscription.suspending? || subscription.suspended?
@olivierlacan
olivierlacan / rails_default_diff.sh
Created July 7, 2012 20:31
Track changes to a skeleton Rails app since a given version
#!/usr/bin/env zsh
# -------------------------------------------------------------------------------- #
# 1304046900 Track changes to a skeleton Rails app since a given `base_version`
# -------------------------------------------------------------------------------- #
## Changelog
# - Update 7/7/2012:
# * rewrote to use Bundler instead of RubyGems
# * attempting to switch to a master branch for which no commit existing was causing a pathspec error
# * simplified rails new commands by running them on the current path (after changing directory to tmp/skeleton_check of course).
# * renamed `old_version` variable to `base_version` for clarity
@olivierlacan
olivierlacan / rails314_to_316.diff
Created July 7, 2012 22:23
Rails 3.1.4 to 3.1.6 defaults
diff --git a/Gemfile b/Gemfile
index ee62ec2..0ace91f 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,9 +1,9 @@
-source 'http://rubygems.org'
+source 'https://rubygems.org'
-gem 'rails', '3.1.4'
+gem 'rails', '3.2.6'