Skip to content

Instantly share code, notes, and snippets.

View yarmand's full-sized avatar

yann ARMAND yarmand

View GitHub Profile
@yarmand
yarmand / catch.sh
Created April 27, 2015 08:17
try catch in bash
#!/bin/bash
function try()
{
if [ -n "$CATCHED_ERROR" ] ; then return ; fi
CATCHED_ERROR=''
CATCHED_ERROR_LINE=$1
TRY_ERROR_FILE=/tmp/try_error.$$
@yarmand
yarmand / chjava.sh
Created December 2, 2014 11:54
chjava for OSX
JAVA_HOME_CMD=/usr/libexec/java_home
function chjava(){
if [ $# -eq 0 ] ; then
$JAVA_HOME_CMD -V
return
fi
export JAVA_HOME=`$JAVA_HOME_CMD -v $*`
}
@yarmand
yarmand / bottles.rb
Created July 2, 2014 10:23
SPA_2014
class Bottles
def song
verses(99, 0)
end
def verses(upper_bound, lower_bound)
upper_bound.downto(lower_bound).map { |i| verse(i) }.join("\n")
end
Host *jumphost-*.int.yammer.com
ServerAliveInterval 30
TCPKeepAlive yes
ForwardAgent yes

Stack your tasks

I just discovered today that rake tasks are fifo stack.

In other words, if I use the task keyword more than once, the process block defined will be added at the end of a list, and all blocks will be called in definition order when calling this task.

The interesting thing is on prerequesites that also get stack in the same order and will be all checked before starting the process stack.

@yarmand
yarmand / Kill-fat-model.md
Created April 15, 2013 10:31
Preparation notes for a talk

[Talk] kill fat models

intro

  • after a time you wake up with a fat app
  • number of features increase, velocity decrease.
  • asymptotyc scalability : increase teams => increase need to sync

Conventions without comprehension

start fast / small and blind

  • data driven architecture
@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"]
@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 / 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 / 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.