Skip to content

Instantly share code, notes, and snippets.

View spacecowb0y's full-sized avatar

Diego spacecowb0y

View GitHub Profile
@jazzido
jazzido / README.md
Last active August 29, 2015 14:27
Mesas en las que un único partido obtuvo votos

La consulta SQL que se muestra se puede ejecutar en la versión SQLite de la base Access que publica la Dirección Nacional Electoral. La consulta incluye todas las mesas, inclusive aquellas que puedan tener incidencias.

Aclaración anti-boludos: si van a hacer escándalo, asegúrense de no estar diciendo cualquier cosa. Chequeen contra los telegramas publicados en resultados.gob.ar

module Paperclip
module ClassMethods
def has_attached_file name, options = {}
include InstanceMethods
write_inheritable_attribute(:attachment_definitions, {}) if attachment_definitions.nil?
attachment_definitions[name] = {:validations => []}.merge(options)
after_save :save_attached_files
before_destroy :destroy_attached_files
module Paperclip
class << self
def logger #:nodoc:
MongoMapper.logger
end
end
module ClassMethods
def has_attached_file name, options = {}
include InstanceMethods
# Problem #1
# If x == y is true, shouldn't y == x always be true as well?
ree-1.8.7-2010.02 > u = User.new :email => "mail@paulbarry.com", :password => "test", :password_confirmation => "test"
=> #<User @id=nil @email="mail@paulbarry.com" @password="$2a$10$PkBdp9e1Yk9nCSliPrdNB.5fKoMeQaMZt5MchV.DhzaP94rkdHQ6m">
ree-1.8.7-2010.02 > u.password == u.password_confirmation
=> true
ree-1.8.7-2010.02 > u.password_confirmation == u.password
@frnz
frnz / diego.rb
Created January 7, 2011 13:25
Diego
# Primero te recomiendo hacer un método 'encript' así:
def encript(hash)
# Devuelve el mismo hash, pero haciéndole digest al password
hash[:password] = Digest::MD5.hexdigest(hash[:password])
return hash
end
# De esa manera podés hacer esto:
post '/signup' do
say -v Zarvox "carepichas"

Tips and tricks

ri documentation

With RVM:

#> rvm docs generate      # => takes some time ^^
#> ri Array
#> ri Array.push
@wycats
wycats / jsonapi.md
Created May 2, 2013 04:11
Ember APIs

JSON API

There are two JSON API styles:

  • The ID Style
  • The URL Style

The ID style is the easiest to get started with, but requires that your clients be able to guess the URLs for related documents. It also locks your API into a particular URL structure, which may become a problem as your API grows.

The URL style requires less guessing on the client side, and makes clients more resilient to API changes, but is trickier to use with relationships and compound documents.

@acapilleri
acapilleri / gist:6898533
Last active December 25, 2015 01:49
Rails App ruby 2.1 MRI vs Rubinius 2.0
Server:
iMac
Mac10,1
Intel Core 2 Duo
3,06 GHz
Cache L2: 3 MB
RAM: 8 GB
bus: 1,07 GHz
@conwayanderson
conwayanderson / SassMeister-input.scss
Last active December 30, 2015 17:32
Generated by SassMeister.com.
// ----
// libsass (v3.3.2)
// ----
$properties: (
margin: 'm',
padding: 'p'
);
$directions: (