Skip to content

Instantly share code, notes, and snippets.

View jhchabran's full-sized avatar
🧀

Jean-Hadrien Chabran jhchabran

🧀
View GitHub Profile
u := Usine clone
u declare("user", user,
user firstname := "John"
user lastname := "Connor"
user age := suite(a, a+2)
)
a := u create("user")
b := u create("user")
Factory.define(:user) do |u|
u.firstname "John"
u.lastname "Connor"
u.sequence(:age) { |i| i ]
end
Usine := Object clone do (
/* (...) */
create := method (factory,
dummy := factories getSlot(factory) clone
parentProto := dummy protos first
parentProto slotNames foreach(slotName,
value := nil
if(parentProto getSlot(slotName) type == "Suite",
if(suites getSlot(slotName),
Usine := Object clone do (
/* (...) */
declare := method (factory,
object := Object clone
call sender setSlot(call argAt(1) name, object)
call sender appendProto(DummyObject)
call evalArgAt(2)
factories setSlot(factory,object)
)
u := Usine clone
u declare("user", user,
user firstname := "John"
user lastname := "Connor"
user age := suite(a, a+2)
)
@jhchabran
jhchabran / gist:779437
Created January 14, 2011 10:07
Little experiment with cache keys
module Cachable
def self.included(receiver)
receiver.class_attribute :cachable
receiver.cachable = Keystore.new
receiver.send(:helper_method, :cachable)
end
class Keystore
def define name, &block
(class << self; self; end).send :define_method, name, &block
@jhchabran
jhchabran / gist:1115457
Created July 30, 2011 12:05
Rvm + Lion, Ree fails to install with a segfault
[2011-07-30 13:59:44] ./installer -a /Users/jh/.rvm/rubies/ree-1.8.7-2011.03 --no-tcmalloc --dont-install-useful-gems
Welcome to the Ruby Enterprise Edition installer
This installer will help you install Ruby Enterprise Edition 1.8.7-2011.03.
Don't worry, none of your system files will be touched if you don't want them
to, so there is no risk that things will screw up.
You can expect this from the installation process:
1. Ruby Enterprise Edition will be compiled and optimized for speed for this
system.
@jhchabran
jhchabran / gist:1115499
Created July 30, 2011 12:58
Homebrew + Lion + Postgres, fails to build
% brew install postgresql
Also installing dependencies: readline, ossp-uuid
==> Downloading ftp://ftp.cwru.edu/pub/bash/readline-6.2.tar.gz
######################################################################## 100.0%
######################################################################## 100.0%==> Downloading patches
######################################################################## 100.0%
######################################################################## 100.0%==> Patching
patching file vi_mode.c
patching file callback.c
==> ./configure --prefix=/usr/local/Cellar/readline/6.2.1 --mandir=/usr/local/Cellar/readline/6.2.1/share/man --infodir=/usr/local/Cellar/readline/6.2.1/share/info --enable-multibyte
@jhchabran
jhchabran / apéro_ruby_20_sept.md
Created September 21, 2011 08:42
Compte rendu de l'apéro ruby, spécial Freelance ( au loop, 20 septembre 2011 )

Intro

  • Comment s'y prendre pour devenir freelance en france ( rails )
  • statut idéal en fonction des tranches de gains
  • Quels types de clients
  • Dev conseils, formations
  • Collaboration type avec un client
  • TDD
  • Design avant ou après le dev
@jhchabran
jhchabran / gist:1343035
Created November 6, 2011 15:33
xvfb init script
#!/bin/bash
XVFB=/usr/bin/Xvfb
# XVFBARGS=":99 -fbdir /var/run -ac"
XVFBARGS=":99 -nolisten tcp -fbdir /var/run"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS