Skip to content

Instantly share code, notes, and snippets.


Adan Alvarado aalvarado

Block or report user

Report or block aalvarado

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
aalvarado / .psqlrc
Last active Aug 29, 2015
postgresql DEVELOPMENT configuration
View .psqlrc
\pset null 'NULL'
\set HISTFILE ~/.psql_history- :HOST - :DBNAME
\set HISTSIZE 100000
\set PROMPT1 '(%n@%M:%>) [%/] > '
\set PROMPT2 ''
\encoding unicode
\pset pager always
\setenv LESS '-iMSsx2 -FX'
View 99-displaymagic.rules
# enable LVDS on HDMI disconnect
SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/local/bin/"
View gist:46e5678f3c65492010e5
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
View inverse_of_test.rb
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source ''
gem 'rails', '4.2.0'
gem 'arel'
gem 'sqlite3'
system 'bundle'
View sti_scope.rb
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source ''
gem 'rails'
gem 'arel'
gem 'sqlite3'
aalvarado / solution.rb
Created Mar 10, 2015
View solution.rb
def solution(a)
((( a.size + 2 ) * ( a.size + 1 )) / 2) - ( a.reduce(&:+) || 0 )
View missing_int_solution.rb
# Missing int from unsorted array and with arbitrary starting int
def solution(a=[])
sum = 0
min = a.first
max = a.last
a.each do |e|
sum += e
min = e if e < min
aalvarado / gist:df2c783f76938cba8408
Created Apr 3, 2015
Pensamientos acerca de la violencia
View gist:df2c783f76938cba8408
Ser inclusivo y tolerante hacia todos los gustos es un buen camino para extender tu circulo de empatia mas alla de familiares y amigos.
Al hacer esto, hay resultados que benefician a la mayoria de forma mas igualitaria. Hay sumas positivas en el cooperacio
View presentation
* Acerca de Git
- ¿Por que es necesario?
- Otras opciones en control de versiones
- Distribuidos y centralizados
* Recursos
- Pro Git book.
- StackOverflow
- Internet
aalvarado / fizzbuzz.rb
Created Jun 1, 2015
FizzBuzz Ruby without any integer modulus or division
View fizzbuzz.rb
limit = 100
fizz = ['']*2 << 'fizz'
buzz = ['']*4 << 'buzz'
(1..limit){ |n| puts n.join(' ') }
You can’t perform that action at this time.