Skip to content

Instantly share code, notes, and snippets.

@ianmurrays
ianmurrays / combinatoria.m
Created November 11, 2010 20:08
Calcula polinomio de lagrange para interpolar data.
function res = combinatoria(n,r)
% Esta es una combinatoria especial, dado que n es un
% polinomio y r es un escalar (para el caso de newton
% adelantado y atrasado)
res = n; % Aca almacenaremos el resultado.
for i=1:r-1
res = res * (n - i);
end
@ianmurrays
ianmurrays / gist:1021992
Created June 12, 2011 21:14
Constraints
// -----------------------------------------------------------------------------------
/**
* Makes sure that, if team A plays against B on a round, team B plays against team A
* on the same round.
*/
bool RTTP::roundConsistency()
{
/*for (size_t d = 0; d < (size_t)this->numberOfDays; d++)
{
@ianmurrays
ianmurrays / deploy.rb
Created July 21, 2011 17:26
Runs test locally before deploying on capistrano.
set :test_log, "logs/capistrano.test.log"
namespace :deploy do
before 'deploy:update_code' do
puts "--> Running tests, please wait ..."
unless system "bundle exec rake > #{test_log} 2>&1" #' > /dev/null'
puts "--> Tests failed. Run `cat #{test_log}` to see what went wrong."
exit
else
puts "--> Tests passed"
@ianmurrays
ianmurrays / I18n devise es
Created September 6, 2011 01:06 — forked from scambra/I18n devise es
devise I18n file in spanish
es:
errors:
messages:
not_found: 'no encontrado'
already_confirmed: 'ya ha sido confirmada'
not_locked: 'no está bloqueada'
expired: "ha caducado, por favor pide uno nuevo"
not_saved:
one: "1 error evitó guardar este %{resource}:"
other: "%{count} errores evitaron guardar este %{resource}:"
@ianmurrays
ianmurrays / .gitconfig
Created October 5, 2011 20:08
Git Configuration
[color]
ui = true
[alias]
st = status
ci = commit
br = branch
co = checkout
df = diff
lg = log -p
@ianmurrays
ianmurrays / apache-site.conf
Created October 26, 2011 18:09
nginx as apache proxy
NameVirtualHost 127.0.0.1:8080
<VirtualHost 127.0.0.1:8080>
ServerAdmin [email protected]
ServerName domain.example.org
ServerAlias www.domain.example.org
DocumentRoot /path/to/docroot
ErrorLog /path/to/docroot/logs/error.log # Optional
CustomLog /path/to/docroot/logs/access.log combined # Optional
RPAFenable On
RPAFsethostname On
@ianmurrays
ianmurrays / git-blame
Created November 11, 2011 12:40
git blame doesn't lie
6c71ff4d app/views/sections/show_excel.html.haml (Gonzalo S 2011-10-12 18:48:22 -0300 14) .table-container
c69c56a5 app/views/sections/show_excel.html.haml (Gonzalo S 2011-11-10 20:31:52 -0300 15) 97198046
@ianmurrays
ianmurrays / faye.ru
Created March 8, 2012 22:40
Faye Private_Pub Config
# Run with: rackup faye.ru -s thin -E production
require "yaml"
require "faye"
begin
require "private_pub"
rescue LoadError
require "bundler/setup"
require "private_pub"
end
@ianmurrays
ianmurrays / devise.es.yml
Created March 19, 2012 19:53
Devise 2.0 Spanish Locale
es:
errors:
messages:
expired: "ha expirado, por favor pide una nueva"
not_found: "no encontrado"
already_confirmed: "ya fue confirmada. Intenta ingresar."
not_locked: "no ha sido bloqueada"
not_saved:
one: "Ha habido 1 error:"
other: "Han habido %{count} errores:"