Skip to content

Instantly share code, notes, and snippets.

View olivierlacan's full-sized avatar

Olivier Lacan olivierlacan

View GitHub Profile
@olivierlacan
olivierlacan / Hash#contain?.patch
Last active August 29, 2015 14:00 — forked from nobu/Hash#comprized?.diff
Proposed implementation for Hash#contains? created by Nobu and slightly tweaked for semantics. Details here: http://olivierlacan.com/posts/proposal-for-a-better-ruby-hash-include/
diff --git i/hash.c w/hash.c
index 007508a..6f39e47 100644
--- i/hash.c
+++ w/hash.c
@@ -2402,6 +2402,28 @@ rb_hash_flatten(int argc, VALUE *argv, VALUE hash)
return ary;
}
+static int
+hash_contain_i(VALUE key, VALUE value, VALUE arg)
diff --git i/hash.c w/hash.c
index 007508a..6f39e47 100644
--- i/hash.c
+++ w/hash.c
@@ -2402,6 +2402,28 @@ rb_hash_flatten(int argc, VALUE *argv, VALUE hash)
return ary;
}
+static int
+hash_comprised_i(VALUE key, VALUE value, VALUE arg)
@olivierlacan
olivierlacan / devise.fi.yml
Created July 17, 2011 20:20 — forked from akonan/gist:786127
Added a filename and corrected the namespace (was incorrectly set to "en").
fi:
errors:
messages:
not_found: "ei löytynyt"
already_confirmed: "on jo vahvistettu, yritä kirjautua sisään uudelleen"
not_locked: "ei ollut lukittu"
not_saved:
one: "1 virhe esti %{resource} tallentamisen:"
other: "%{count} virhettä esti %{resource} tallentamisen:"
@olivierlacan
olivierlacan / devise.is.yml
Created July 17, 2011 21:45 — forked from sozialhelden/devise.is.yml
devise i18n translations for icelandic
is:
errors:
messages:
not_found: "Afsakið, síða ekki fundin."
not_authorized: "Afsakið, auðkenning mistókst"
not_available: "Afsakið, þessu síða er tímabundið niðri."
not_existent: "Afsakið, þessi staður er ekki til lengur."
devise:
confirmations:
confirmed: "Aðgangurinn hefur verið staðfestur. Þú ert núna skráður inn"
@olivierlacan
olivierlacan / devise.my.yml
Created July 17, 2011 23:08 — forked from iqbalhasnan/devise.my.yml
Devise Malaysian Translation
# Additional translations at http://github.com/plataformatec/devise/wiki/I18n
my:
errors:
messages:
not_found: "tidak dijumpai"
already_confirmed: "sudah disahkan"
not_locked: "tidak dikunci"
devise:
@olivierlacan
olivierlacan / syntax_highlighting.py
Created August 31, 2011 14:47 — forked from JeanMertz/syntax_highlighting.py
Ruby on Rails syntax highlight switcher for Sublime Text 2
# ======================================================================================= #
# NOTE: This is relatively outdated, you should use the DetectSyntax package
# from Package Control instead: http://wbond.net/sublime_packages/community#sort-installs
# ======================================================================================= #
# Instructions: put this inside of the following folder on a Mac:
# /Users/<yourusername>/Library/Application\ Support/Sublime\ Text\ 2/Packages/User/
# ======================================================================================= #
import sublime, sublime_plugin
import os
@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 / 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/ .*//'`
@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 / 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.