Skip to content

Instantly share code, notes, and snippets.

View yarmand's full-sized avatar

yann ARMAND yarmand

View GitHub Profile
@yarmand
yarmand / mongoid.yml
Created May 21, 2011 16:36
mongoid for heroku
defaults: &defaults
host: localhost
# slaves:
# - host: slave1.local
# port: 27018
# - host: slave2.local
# port: 27019
development:
<<: *defaults
@yarmand
yarmand / gist:1193672
Created September 4, 2011 22:58
coffeeScript global var
window.foo= () -> console.log('foo')
@yarmand
yarmand / object_extend_sample.rb
Created May 22, 2012 20:10
extending an object
module AdditionalMethods
def new_method
"do some things"
end
end
obj = SomeObject.new
obj.extend(AdditionalMethods)
puts obj.new_method
@yarmand
yarmand / gist:3721309
Created September 14, 2012 11:00
2012-09-14 migration error
rake db:migrate
(in /opt/workfeed)
== PreMigrateTask: started.
-- /opt/workfeed/db/pre_migrate/000_pg_log_type.sql
NOTICE: drop cascades to 13 other objects
DETAIL: drop cascades to function "pg_log$get_log_data"(timestamp without time zone,timestamp without time zone,text,boolean)
drop cascades to view all_queries_td
drop cascades to view all_queries_wk
drop cascades to view all_queries_mn
drop cascades to view ddl_queries_td
@yarmand
yarmand / gist:3721326
Created September 14, 2012 11:05
2012-09-14 reset_environment do not work for me
[vagrant@u64 workfeed]$ rake --trace dev:reset_environment
(in /opt/workfeed)
** Invoke dev:reset_environment (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute dev:reset_environment
** Invoke restart (first_time)
** Execute restart
memcached(1526): Operation not permitted
memcached: no process found
@yarmand
yarmand / favtext.js
Created November 27, 2012 13:55
Draw text on favicon
(function () {
var canvas = document.createElement('canvas'),
ctx,
img = document.createElement('img'),
link = document.getElementById('favicon').cloneNode(true),
day = (new Date).getDate() + '';
if (canvas.getContext) {
canvas.height = canvas.width = 16; // set the size
ctx = canvas.getContext('2d');
@yarmand
yarmand / railsberry_proposal.md
Last active December 10, 2015 18:28
RailsBerry talk proposal

Public Description

Yann: "We need to delete this long_name field from the User model - it's not been used for a long time." Nick: "I'm in if you are. Lets go exploring!"

Follow Yann and Nick as they follow this journey for removing a database column from start to finish - how hard can it be?

Privage description

We would like to structure the talk as a discussion between two engineers, rather than a solo speaker. The reason is that we want to explain the various design decisions we were making, and also make it more engaging for the audience.

@yarmand
yarmand / double_include.rb
Created February 7, 2013 11:19
If you include a module more than once, included get called every time.
module A
def self.included(base)
puts "A included in #{base}"
end
end
class B
include A
end
@yarmand
yarmand / serializable_hash.rb
Created February 13, 2013 23:02
code for blog post
class User
alias_method :super_serializable_hash, :serializable_hash
def serializable_hash(options = {})
options.merge! {
:only => self.attributes.keys.map(&:to_sym) -
(self.class.deprecated_attributes ||
[]).map(&:to_sym)
}
super_serializable_hash(options)
end
@yarmand
yarmand / .gitconfig
Created March 25, 2013 17:57
my actual .gitconfig
[gui]
[diff]
tool = vim
[difftool "vim"]
cmd = "vimdiff \"$LOCAL\" \"$REMOTE\""
[merge]
[guitool "Files/Open"]