Skip to content

Instantly share code, notes, and snippets.

View angelbotto's full-sized avatar
🏃

Angel Celis Botto angelbotto

🏃
View GitHub Profile
@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

@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 / 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
#################################################################
#
# File: lib/api.rb
#
#################################################################
require 'user' # ActiveRecord model
# Connect to the db
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])
@angelbotto
angelbotto / Gemfile
Last active December 20, 2015 01:49
Unicorn en Heroku
#agregar
gem 'unicorn'
@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
Created September 15, 2013 08:28
Phusion passenger in heroku
gem 'passenger', '>= 4.0.16'
# We generate a basic project
say
dev = yes?("Are you using padrino-dev?").present?
tiny = yes?("Do you need a tiny structure?").present?
adapter = ask("SQL adapter for ActiveRecord (sqlite, mysql, postgres, none):")
project :test => :none, :renderer => :haml, :script => :jquery, :orm => :activerecord, :dev => dev, :tiny => tiny, :adapter => adapter
say "=> Installing exception notifier", :magenta
execute_runner :plugin, :exception_notifier
@angelbotto
angelbotto / date_range.rb
Created December 1, 2013 22:37
Perfect for create charts..
date = Time.now
start_date = Time.new(date.year, date.month, 1)
end_date = start_date + 1.month
@angelbotto
angelbotto / vid2gif.pl
Created December 2, 2013 05:49
Create gif from video .... #newproject
#!/usr/bin/perl
# Quick script to convert a video file to a GIF based on time indicators.
# Inspired by the ugly Bash script at http://www.davidgouveia.net/2011/09/how-to-convert-video-to-animated-gifs-from-a-linux-console/
# See `vid2gif --help` for more info.
use strict;
use warnings;
use diagnostics; # useful for debugging;
use feature 'say'; # beats print;
use Getopt::Long; # for parsing command-line options;
use File::Temp; # for tempdirs to store scratch files;