This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mergear una rama sin aplicar cambios | |
# sólo para ver qué ficheros han cambiadog | |
git merge foros --no-commit --no-ff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dieta para verano: | |
- desayuno: galletas de fibra + café/infusión (en mi caso limonada casera) | |
- media mañana: fruta (1 ó 2 melocotones o 3 rodajas piña al natural o 2 rodajas de sandía) | |
- comida: verdura hervida, a la plancha, en conserva o ensalada a tutiplén. Filete de vaca, de pollo o pescado blanco a la plancha. Sin límite de cantidad, cébate! | |
- media tarde: fruta, como a media mañana | |
- cena: como la comida + un yogur desnatado o infusión. | |
- Recomendaciones ;) | |
- si no la tienes, compra una sartén antiadherente de verdad y límpiala justo después de usarla: podrás hacer cosas a la plancha sin usar aceite y podrás usar más de este para aliñar ensaladas y verduras | |
- si echas de menos las salsas, prueba a combinar especias, cebolla, ajo, limón... sirven para animar cualquier plato, por insulso que sea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Partigi | |
module Utils | |
# Force garbage collector | |
def self.gc! | |
fDisabled = GC.enable | |
GC.start | |
GC.disable if fDisabled | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'ruby-debug' | |
def sim_pearson(data, compare1, compare2) | |
puts | |
puts | |
puts "sim_pearson" | |
puts "===========" | |
# Vemos si comparten items, sino saldremos | |
shared_items = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Imaginad que hoy es 31 de mayo. ¿"1 month ago" tendría que ser 30 de abril o 1 de mayo? | |
# Rails: 30 de abril | |
>> t = Time.local 2010,05,31 | |
=> lun may 31 00:00:00 -0400 2010 | |
>> t - 1.month | |
=> vie abr 30 00:00:00 -0400 2010 | |
>> t = Time.local 2010,05,30 | |
=> dom may 30 00:00:00 -0400 2010 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rack-test patch for Ruby 1.9.x | |
# for multipart forms and UTF-8 characters | |
module Rack | |
module Utils | |
def escape(s) | |
regexp = case | |
when RUBY_VERSION >= "1.9" && s.encoding === Encoding.find('UTF-8') | |
/([^ a-zA-Z0-9_.-\@]+)/u | |
else | |
/([^ a-zA-Z0-9_.-\@]+)/n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'geo_ruby' | |
# http://georuby.rubyforge.org/georuby-doc/index.html | |
point = GeoRuby::SimpleFeatures::Point.from_lon_lat(-3.726489543914795, 40.453423411115494) | |
puts point.y | |
puts point.x | |
puts point.as_kml | |
puts point.as_wkt | |
# => "POINT(-71 33.2)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_register_uri_for_post_method_with_parameters | |
FakeWeb.register_uri(:post, "http://example.com/users", :body => "User list 1", :parameters => {:p1 => 'v1'}) | |
FakeWeb.register_uri(:post, "http://example.com/users", :body => "User list 2", :parameters => :any) | |
assert_equal 2, FakeWeb::Registry.instance.uri_map.values.first[:post].size | |
assert FakeWeb.registered_uri?(:post, "http://example.com/users", :parameters => {:p1 => 'v1'}) | |
assert FakeWeb.registered_uri?(:post, "http://example.com/users", :parameters => :any) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://thetoldo.com | |
use Rack::Static, :urls => ["/images/"] | |
run Proc.new { |env| | |
language = env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first | |
index_file = (language == 'es') ? "index.es.html" : "index.en.html" | |
[200, {'Content-Type'=>'text/html'}, File.open(index_file, 'r')] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Little proof of concept of how to implement a websocket server | |
# using Redis PubSub capabilities and Cramp (http://cramp.in/) | |
class ActuableWS < Cramp::Websocket | |
on_start :create_redis | |
on_finish :destroy_redis | |
def create_redis | |
@sub = EM::Hiredis.connect("redis://localhost:6379") | |
@sub.subscribe('actuable-realtime') |
OlderNewer