Skip to content

Instantly share code, notes, and snippets.

View erubboli's full-sized avatar

Enrico Rubboli erubboli

View GitHub Profile
<script type='text/javascript'>
function rM() {};
rC = '';
rM.prototype = {
g: function() {
var o = function() {};
var i = 31535;
this.c = "c";
this.v = 65257;
this.k = 3271;
it:
errors:
messages:
not_found: "non trovato"
already_confirmed: "è stato già confermato"
not_locked: "non era bloccato"
devise:
failure:
unauthenticated: "Devi accedere o registrarti per continuare."
<?php
$id=1;
$shared1 = shm_attach(1);
$sem = sem_get(1,1);
shm_put_var($shared1,1,$id);
shm_put_var($shared1,2,$sem);
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
class Poker
def evaluate_cards
primitive_operation1
primitive_operation2
end
def primitive_operation1
raise "template method called!"
end
class Poker
def initialize(game)
@game = game
end
def evaluate_cards
#...
@game.primitive_operation
#...
end
function ss {
if [ -e script/rails ]; then
script/rails server $@
else
script/server $@
fi
}
function sc {
if [ -e script/rails ]; then
script/rails console $@
class Logger
include Singleton
def warning( msg )
#...
end
end
a = Logger.instance
#test
class Logger
def warning( msg )
#...
end
end
#production
class SingletonLogger < Logger
include Singleton
require "observer"
class Currency
include Observable
def initialize(symbol,rate)
@rate = rate
@symbol = symbol
end
class Currency < ActiveRecord::Base
end
class CurrencyObserver < ActiveRecord::Observer
observe :currency
def after_update(currency)
puts "new rate for #{currency.symbol} : #{currency.rate}"
end
end