Skip to content

Instantly share code, notes, and snippets.

View wacko's full-sized avatar

Joaquín Vicente wacko

  • Buenos Aires, Argentina
View GitHub Profile
@wacko
wacko / exception.rb
Created January 15, 2014 18:47
WHOOOA!!!
#! /usr/bin/env ruby
def ლ(_) Exception end
def ಠ益ಠლ; end
raise ლ(ಠ益ಠლ), "WTF, dude!"
@wacko
wacko / wtf_patch.rb
Created February 14, 2014 15:49
Rails freezes when trying to generate a broken route
# Related: https://github.com/rails/rails/issues/1525#issuecomment-1782439
# Rails freezes when
module ActionDispatch
module Routing
class RouteSet
def inspect
# The solution is... to throw a random exception (to halt the normal flow, I think)
wtf!
end
end
@wacko
wacko / imagemagick_install.sh
Created October 30, 2014 14:55
Steps for installing ImageMagick-6.8.9 on Debian
sudo apt-get update
sudo apt-get install build-essential checkinstall libx11-dev libxext-dev zlib1g-dev libpng12-dev libjpeg-dev libfreetype6-dev libxml2-dev
sudo apt-get install imagemagick
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar -xzvf ImageMagick.tar.gz
cd ImageMagick-6.8.9-9
./configure
make
sudo make install
@wacko
wacko / instrucciones.md
Last active January 19, 2017 13:09 — forked from ceneon/gist:8222574
Recategorización de Monotributo

Para recategorizarte en el Monotributo, la aplicación de AFIP da error de Javascript por todos lados. A menos que entres con Internet Explorer...

Para hacer el trámite en Chrome, Firefox o cualquier browser decente:

  1. Ingresar a la AFIP (Acceso con Clave Fiscal)
  2. Ir a Sistema Registral
  3. Hacer click en la lupa
  4. Registro tributario > Monotributo
  5. Este es el 1er formulario que se rompe. Hay dos soluciones:
@wacko
wacko / gemcount
Created February 25, 2015 21:36
How many gems does your project use?
#!/bin/bash
grep -o -E "([a-z0-9_-]+) \(" Gemfile.lock | sed -E 's/ \(//' | sort | uniq
@wacko
wacko / pre-commit
Last active September 16, 2020 22:57
Git hook to avoid commit debug lines (binding.pry console.log debugger...)
#!/usr/bin/env ruby
# Validates that you don't commit forbidden keywords to the repo
# You can skip this checking with 'git commit --no-verify'
exit 0 if ARGV.include?('--no-verify')
# Update this list with your own forbidden keywords
KEYWORDS = %w(binding.pry console.log debugger)
def red(text) "\033[31m#{text}\033[0m"; end
@wacko
wacko / example.rb
Created April 20, 2015 01:29
Very simple and stupid key-value store using ActiveRecord
# Use KeyValue to store globally unique data
KeyValue.set('api_key', '123') # => true
KeyValue.get('api_key') # => '123'
# You can use the alternate syntax:
KeyValue['api_key'] = '123' # => true
KeyValue['api_key'] # => '123'
@wacko
wacko / app.rb
Created May 14, 2015 18:33
Cuba basic test
require 'cuba'
class MyApp < Cuba
define do
on root do
res.write "it works!"
end
end
@wacko
wacko / 01_node.sh
Last active August 4, 2019 08:10
Nativefier installer (Node.js + HomeBrew)
brew install 'nvm'
NODE_VERSION="4.4.3"
if ! grep -qs 'source $(brew --prefix nvm)/nvm.sh' ~/.bash_profile; then
printf 'export PATH="$PATH:/usr/local/lib/node_modules"\n' >> ~/.bash_profile
printf 'source $(brew --prefix nvm)/nvm.sh\n' >> ~/.bash_profile
fi
source $(brew --prefix nvm)/nvm.sh
nvm install "$NODE_VERSION"
@wacko
wacko / gemcount
Last active June 21, 2017 20:53
List all the different gems on your Gemfile.lock
#!/bin/bash
print_gems() {
awk '/([[:alnum:]_]+) \(/{ print $1 }' Gemfile.lock | sort -u
}
count() {
grep -c ^
}