Skip to content

Instantly share code, notes, and snippets.

View Porta's full-sized avatar

Julián Porta Porta

View GitHub Profile
module Ohm
class List
def [](range)
fetch(redis.call("LRANGE", key, range.begin, range.end))
end
end
end
@Porta
Porta / out.sh
Created February 25, 2014 19:12
$ rake test
....................test/model.rb:73: warning: assigned but unused variable - foo
...................................................
test: find all
line: assert all.detect {|e| e.name == "Ruby Meetup" }
file: test/model.rb +369
line: to_a.each { |e| yield e }
file: /home/porta/Dropbox/Code/ruby/ohm/lib/ohm.rb +163
line: fetch(ids)
file: /home/porta/Dropbox/Code/ruby/ohm/lib/ohm.rb +159
class User < Ohm::Model
set :requests, :Request
end
class Request < Ohm::Model
attribute :path
attribute :processed
irb(main):006:0> '+10'.to_i
=> 10
irb(main):007:0> '10+'.to_i
=> 10
irb(main):008:0>
irb(main):008:0> '-10'.to_i
=> -10
irb(main):009:0> '10-'.to_i
=> 10
@Porta
Porta / alegria.rb
Created June 3, 2014 20:31
Pura alegría.
require "malone"
require "mote"
load('importer.rb')
mailer = Malone.connect(url: "smtp://foo%40localhost:pistola@localhost:1025",domain: "localhost")
data = File.read('mails.csv').encode("UTF-8", invalid: :replace, undef: :replace, replace: "?")
imported_data = Importer.import(data)
@Porta
Porta / 0_reuse_code.js
Created June 7, 2014 18:14
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Porta
Porta / cuba.rb
Last active August 29, 2015 14:04
on ":bucket" do |name|
with(name: name) do
run Buckets
end
on ":key" do |key|
on ":id" do |id|

Keybase proof

I hereby claim:

  • I am Porta on github.
  • I am porta (https://keybase.io/porta) on keybase.
  • I have a public key whose fingerprint is C680 46A3 5D79 9DE5 C72C 386D 72A8 1C36 5217 36CC

To claim this, I am signing this object:

#!/bin/bash
event=$1
worker=$2
pid=$3
env=$RACK_ENV
#mando mail con el error.
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("elements", "1", {
packages: "keyboard"
});
function onLoad() {
$('.rtl textarea, .rtl input').attr('dir', 'rtl');
var kbd = new google.elements.keyboard.Keyboard(