Skip to content

Instantly share code, notes, and snippets.

View angelbotto's full-sized avatar
🏃

Angel Celis Botto angelbotto

🏃
View GitHub Profile
@angelbotto
angelbotto / Gemfile
Created September 15, 2013 08:28
Phusion passenger in heroku
gem 'passenger', '>= 4.0.16'
@angelbotto
angelbotto / Gemfile
Created July 31, 2013 09:55
keepalive in padrino and heroku easy xd
source 'http://rubygems.org'
ruby "1.9.3"
gem 'httparty'
gem 'clockwork'
gem 'foreman'
@angelbotto
angelbotto / Gemfile
Last active December 20, 2015 01:49
Unicorn en Heroku
#agregar
gem 'unicorn'
#################################################################
#
# File: lib/api.rb
#
#################################################################
require 'user' # ActiveRecord model
# Connect to the db
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])
@angelbotto
angelbotto / perfectUsername.rb
Last active December 10, 2015 14:49
Creando el username perfecto, un pequeño metodo que ayuda a remplazar y eliminar caracteres extraños para crear un username perfecto :) :s si tiene ideas de como poder mejorarlo agradeceria enormemente :)
def perfectUsername(string)
string = string.tr(' ','-')
string = string.tr('áàäâªÁÀÂÄéèëêÉÈÊËíìïîÍÌÏÎóòöôÓÒÖÔ','aaaaaAAAAeeeeEEEEiiiiIIIIooooOOOOúùüûÚÙÛÜuuuuUUUUñÑçÇnNcC')
string = string.gsub(/[^0-9A-Za-z]/, '')
end
@angelbotto
angelbotto / case-sensitive.rb
Created December 25, 2012 23:26
querry en mongomapper ignorando mayusculas y buscando letra o palabra especifica :) para crear buscadores :) se pueden hacer busquedas muy complejas :) super :)
@persons = Person.where(:$or => [{:name => {:$regex => /#{params[:search]}/i }}, {:username => {:$regex => /#{params[:search]}/i}} ] )
@angelbotto
angelbotto / imgfromcss.md
Last active December 10, 2015 03:28
extraer imagenes de un css y descargarlas con wget

#Descargar imagenes de un css

para dar solucion a un pequeño problema que tuve, que necesicaba extraer todas las imagenes de un archivo css en especial.

  1. extraemos las imagenes.
    grep -o 'http[a-zA-Z0-9/.:_-]*' test.css > test/images.txt

  2. descargamos las imagenes. wget -i test/images.txt