Skip to content

Instantly share code, notes, and snippets.

View olivierlacan's full-sized avatar

Olivier Lacan olivierlacan

View GitHub Profile
@olivierlacan
olivierlacan / bundler_errrors
Last active January 1, 2016 06:49
Bundler has been giving me these errors (across completely different repos) for a while now and I really need to figure out what's causing this. Anybody have a clue?
Bundler gave the error "Could not find rake-10.1.0 in any of the sources" while processing "/Users/olivierlacan/Development/envylabs/codeschool/iOS7Course/Gemfile". Perhaps you forgot to run "bundle install"?
Bundler gave the error "Could not find libv8-3.11.8.13 in any of the sources" while processing "/Users/olivierlacan/Development/envylabs/codeschool/TryDevTools/Gemfile". Perhaps you forgot to run "bundle install"?
Bundler gave the error "Could not find gem 'jquery-rails (~> 2.0.1) ruby' in the gems available on this machine." while processing "/Users/olivierlacan/Development/envylabs/codeschool/BackboneCourse/Gemfile". Perhaps you forgot to run "bundle install"?
Bundler gave the error "Could not find libv8-3.11.8.17 in any of the sources" while processing "/Users/olivierlacan/Development/envylabs/codeschool/FrontEndFormationsCourse/Gemfile". Perhaps you forgot to run "bundle install"?
Bundler gave the error "Could not find libv8-3.11.8.13 in any of the sources" while processing "/Users/olivierlacan/Devel
@olivierlacan
olivierlacan / shell_out_gem_require_test.rb
Created December 16, 2013 22:18
Cool way to shell out in order to test that an external dependency (gem) can be require successfully, courtesy of Tyler Hunt.
describe 'Ransack' do
it 'can be required without errors' do
output = `bundle exec ruby -e "require 'ransack'" 2>&1`
output.should be_empty
end
end
@olivierlacan
olivierlacan / DebugKiller.sublime-settings
Last active December 22, 2015 21:19
My Debug Killer (Sublime Text plugin available on Package Control) configuration to catch console.log statements and debugger statements in either JavaScript or CoffeeScript.
{
"patterns": [
{
"pattern": "(console\\.log\\(.*?\\))",
"scopes": [
"storage.type.function.js",
"meta.function.json.js",
"source.js"
]
},
@olivierlacan
olivierlacan / tandana_mtegha_questionnaire.md
Last active December 21, 2015 09:29
Tandana Mtegha is a high school pupil from South Africa who contacted Code School support about a feasibility study he's conducting about learning to program. His requirement is to "conduct an interview with someone experienced in this field"

Tandana Mtegha's Questionnaire

  • What is your name?
  • Are you able to program? If so in what languages are you fluent?
  • How long did it take you to learn those languages?
  • How did you learn to code? Who had taught you?
  • Which language do you enjoy coding in?
  • Which language do you think would be the best for learning?
  • Which language was the hardest/easiest, in your opinion to learn?
  • Do you think it is important for people to be able to learn how to code?
@olivierlacan
olivierlacan / export_html_sublime_text_2_plugin_user_settings.json
Created July 18, 2013 02:16
Package user settings to user in order to have the ExportHtml Sublime Text 2 plugin use the current color scheme by default, not export line numbers, and not wrap.
{
"html_panel": [
// Browser print color (selections and multi-selections allowed)
{
"Browser Print - Color": {
"numbers": false,
"multi_select": true,
"style_gutter": false
}
}
@olivierlacan
olivierlacan / assistive_devices.md
Created June 21, 2013 07:31
How to re-enable Divvy in OS X 10.9 Mavericks when it complains about needing to "enable access to assistive devices".

At the time of this writing Divvy hasn't been updated for OS X 10.9 so it tries to direct you to the Accessibility panel of the System Preferences. Actually the assistive device settings have been moved to the Security pane as shown below:

@olivierlacan
olivierlacan / rendering_partials.md
Last active May 31, 2019 18:09
How to use shorthand syntax for rendering partials in Rails

Inside of Rails views, you can call partial views (any view file named with an underscore as the first character) like this:

render partial: "partial_name"

You can also pass local variables, which is fantastic to ensure that your views & partials don't try to access data you didn't specifically hand to them from the controller.

@tylerhunt showed me this week that it was possible to avoid using instance variables (which are copied from the Rails controller to the corresponding Rails views) altogether by passing local variables to the view.

@olivierlacan
olivierlacan / deploy.thor
Created June 7, 2013 05:47
The hacky little Thor script I use to deploy my Jekyll site to GitHub Pages since it uses "unsafe plugins".
class Deploy < Thor
include Thor::Actions
desc "github", "deploy to GitHub Pages"
def github
original_path = Dir.pwd
deploy_path = "/Users/olivierlacan/Development/perso/olivierlacan.github.com"
puts "Running Jekyll build --destination #{deploy_path}"
run "jekyll build --destination #{deploy_path}"
@olivierlacan
olivierlacan / gary_bernhardt_screencasting_parley.md
Created June 1, 2013 03:04
Gary Bernhardt on Screencasting

I'm planning on either writing this up in detail or maybe doing a screencast about screencasting, but I'll give a short version here.

On sound quality:

This matters a lot. In decreasing order of importance:

  1. Remove echo. You have to hear this to understand. Set up a mic in front of your mouth and record a sentence. Then, put a thick comforter over you and the mic and say it again at the same distance. Listen to
@olivierlacan
olivierlacan / segfault_pg_0_11_0_ruby_2_0_0.md
Last active December 17, 2015 19:29
NoMethodError: undefined method `result' for #<TypeError: wrong argument type nil (expected Array)> on Rails 3.2.13 with Ruby 2.0.0p-195 when booting Rails app

If you see this error:

NoMethodError: undefined method `result' for #<TypeError: wrong argument type nil (expected Array)>

It's very likely you have the same issue I encoutered.

Basically, inside ActiveRecord there's a little method called configure_connection which does exactly that. It checks an instance variable called @config for @config[:encoding] and if that's present, it calls: