Skip to content

Instantly share code, notes, and snippets.

View olivierlacan's full-sized avatar

Olivier Lacan olivierlacan

View GitHub Profile
@olivierlacan
olivierlacan / git_log.md
Created August 2, 2012 15:06
My git log custom output aliases
git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"
git config --global alias.lol "log --graph --decorate --pretty=oneline --abbrev-commit --all"
git config --global alias.mylog "log --pretty=format:'%h %s [%an]' --graph"

To check that they've been added correctly, first run git config --list. You should see something like this in the midst of all your other configuration:

alias.hist=log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short
@olivierlacan
olivierlacan / old_ruby.md
Created August 6, 2012 16:12
GCC, LLVM and installing old ruby versions

GCC, LLVM and installing old ruby versions

I highly recommend using ruby-install & rbenv to install Ruby versions on your system if you're using OS X.

Homebrew

First you'll need Homebrew (the best package manager for OS X).

ruby <(curl -fsSk https://raw.github.com/mxcl/homebrew/go)

@olivierlacan
olivierlacan / postgres_homebrew_vs_mountain_lion.md
Created August 6, 2012 19:29
PostgreSQL pg_config output from Homebrew install vs. Mountain Lion default
# Output from the OS X 10.8 (Mountain Lion) install
$ /usr/bin/pg_config

BINDIR = /usr/local/Cellar/postgresql/9.1.4/bin
DOCDIR = /usr/local/Cellar/postgresql/9.1.4/share/doc/postgresql
HTMLDIR = /usr/local/Cellar/postgresql/9.1.4/share/doc/postgresql
INCLUDEDIR = /usr/local/Cellar/postgresql/9.1.4/include
PKGINCLUDEDIR = /usr/local/Cellar/postgresql/9.1.4/include
INCLUDEDIR-SERVER = /usr/local/Cellar/postgresql/9.1.4/include/server
@olivierlacan
olivierlacan / gist:3278913
Created August 6, 2012 22:12 — forked from kyanny/gist:1668822
bashrc prompt git && rbenv
# rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
source ~/.rbenv/completions/rbenv.bash
# prompt with ruby version
# rbenv version | sed -e 's/ .*//'
__rbenv_ps1 ()
{
rbenv_ruby_version=`rbenv version | sed -e 's/ .*//'`
You should not use the `match` method in your router without specifying an HTTP method. (RuntimeError)
If you want to expose your action to GET, use `get` in the router:
Instead of: match "controller#action"
Do: get "controller#action"
@olivierlacan
olivierlacan / article.rb
Created November 2, 2012 06:38
Associations in Rails 4 return a CollectionProxy instead of an Array
class Article < ActiveRecord::Base
has_and_belongs_to_many :tags
end
@olivierlacan
olivierlacan / gist:4062929
Last active February 10, 2024 10:57 — forked from Gregg/gist:968534
Code School Screencasting Framework

Screencasting Framework

The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.

Why you should care about screencasting?

You're probably aren't going to take the time to read this document if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.

  1. Communicating more effectively - At Envy Labs we produce screencasts for our clients all the time. Whether it's demoing a new feature or for a presentation for an invester, they're often much more effective and pleasent than a phone call or screen sharing.
@olivierlacan
olivierlacan / science-based_development.md
Last active October 13, 2015 01:47
Science-based Development

Science-based Development

Summary

Development, like science, is a messy endeavor. It’s near impossible to control all the variables. Testing code is a noble goal, but it’s very easy to test the wrong thing. Many experienced scientists are fooled by their senses and biases. To account for that they crafted and refined a Scientific Method. That method has been stress tested by centuries of experimentation, discovery and peer-review. It probably wouldn’t hurt to try to apply it to development and see what it can offer.

Steps

  1. Inquire
  2. Hypothesize
  3. Disprove
@olivierlacan
olivierlacan / 1_poltergeist_flash.rb
Last active December 11, 2015 16:59
Poltergeist has a neat but unintuitive way of returning cookies from `page.driver.cookies` or `Capybara.current_session.driver.cookies`, here's how you get them to play nice with assertions in RSpec integration specs using Capybara for example.
module PoltergeistFlash
module TestHelpers
def flash_cookie
cookie = CGI.unescape Capybara.current_session.driver.cookies["flash"].value
return {} unless cookie
JSON.parse(cookie).with_indifferent_access
rescue JSON::ParserError
{}
end
end
@olivierlacan
olivierlacan / session_store_deprecation.md
Created February 24, 2013 22:57
This is the deprecation warning thrown by Rails 4 to invite an update of the session_store.rb file

DEPRECATION WARNING: You didn't set config.secret_key_base in config/initializers/secret_token.rb file. This should be used instead of the old deprecated config.secret_token in order to use the new EncryptedCookieStore. To convert safely to the encrypted store (without losing existing cookies and sessions), see http://guides.rubyonrails.org/upgrading_ruby_on_rails.html#action-pack.