Skip to content

Instantly share code, notes, and snippets.

@esaborit4code
esaborit4code / orphancheck.sh
Last active January 9, 2017 11:25
Bash script to find unused images within a project's folder. Based on Volomike's script at http://stackoverflow.com/a/8174681
#!/bin/bash
# Based on Volomike's script at http://stackoverflow.com/a/8174681
MYPATH=$1
ALL_IMAGES=$MYPATH/all_images
UNUSED_IMAGES=$MYPATH/unused_images
echo "" > $ALL_IMAGES
for format in jpg jpeg png gif; do
@esaborit4code
esaborit4code / lircd.conf
Last active December 19, 2015 17:28
My lircd.conf for Raspberry's infrared remote control. /etc/lirc/lircd.conf
# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.9.0-pre1(default) on Fri Jul 12 23:09:53 2013
#
# contributed by
#
# brand: /home/pi/lircd.conf
# model no. of remote control:
@esaborit4code
esaborit4code / .lircrc
Last active December 19, 2015 17:38
Setup files to control a window's blind with IR remote and GPIO pins.
begin
prog = irexec
button = KEY_REWIND
config = echo 0 > /sys/class/gpio/gpio21/value; echo 1 > /sys/class/gpio/gpio22/value; echo "`date` ROLL UP!" >> /home/pi/window_blind_log;
end
begin
prog = irexec
button = KEY_FASTFORWARD
config = echo 1 > /sys/class/gpio/gpio21/value; echo 0 > /sys/class/gpio/gpio22/value; echo "`date` ROLL DOWN!" >> /home/pi/window_blind_log;
@esaborit4code
esaborit4code / bookmarks
Created June 30, 2014 15:56
JS bookmarks
jQueryfy: loads jQuery in pages that don't have it
javascript: (function()%7Bvar el%3Ddocument.createElement(%27div%27),b%3Ddocument.getElementsByTagName(%27body%27)%5B0%5D%3Botherlib%3Dfalse,msg%3D%27%27%3Bel.style.position%3D%27fixed%27%3Bel.style.height%3D%2732px%27%3Bel.style.width%3D%27220px%27%3Bel.style.marginLeft%3D%27-110px%27%3Bel.style.top%3D%270%27%3Bel.style.left%3D%2750%25%27%3Bel.style.padding%3D%275px 10px%27%3Bel.style.zIndex%3D1001%3Bel.style.fontSize%3D%2712px%27%3Bel.style.color%3D%27%23222%27%3Bel.style.backgroundColor%3D%27%23f99%27%3Bif(typeof jQuery!%3D%27undefined%27)%7Bmsg%3D%27This page already using jQuery v%27%2BjQuery.fn.jquery%3Breturn showMsg()%3B%7Delse if(typeof %24%3D%3D%27function%27)%7Botherlib%3Dtrue%3B%7D function getScript(url,success)%7Bvar script%3Ddocument.createElement(%27script%27)%3Bscript.src%3Durl%3Bvar head%3Ddocument.getElementsByTagName(%27head%27)%5B0%5D,done%3Dfalse%3Bscript.onload%3Dscript.onreadystatechange%3Dfunction()%7Bif(!done%26%26(!this.readyState%7
@esaborit4code
esaborit4code / CSS-Penis.markdown
Created July 16, 2014 15:03
A Pen by Eduardo Saborit.
@esaborit4code
esaborit4code / StripeI18n.es.js
Last active June 30, 2023 21:51
Stripe error messages spanish translation
StripeI18n = {
es: {
errors: {
incorrect_number: "El número de tarjeta es incorrecto.",
invalid_number: "El número de tarjeta no es un número de tarjeta válido.",
invalid_expiry_month: "El mes de caducidad de la tarjeta no es válido.",
invalid_expiry_year: "El año de caducidad de la tarjeta no es válido.",
invalid_cvc: "El código de seguridad de la tarjeta no es válido.",
expired_card: "La tarjeta ha caducado.",
incorrect_cvc: "El código de seguridad de la tarjeta es incorrecto.",
@esaborit4code
esaborit4code / db_change_on_the_fly
Last active August 29, 2015 14:11
DB server change on the fly
mysqldump -h origin.server.com -u the_origin_user -p the_origin_database --ignore-table=the_origin_database.that_huge_table | tee dump.sql | mysql the_database -u the_user --password=ThePassword
mysqldump -h origin.server.com -u the_origin_user -p the_origin_database that_huge_table --no-data | mysql the_database -u the_user --password=ThePassword
mysqldump -h origin.server.com -u the_origin_user -p the_origin_database that_huge_table | mysql the_database -u the_user --password=ThePassword
#!/usr/bin/env ruby
require 'json'
exec 'rspec --format json --out rspec_results.json' unless File.exists? 'rspec_results.json'
results = JSON.parse(File.read 'rspec_results.json')
total_runtime = results['summary']['duration']
total_examples = results['examples']
@esaborit4code
esaborit4code / rediparser.rb
Created June 10, 2016 11:20
Redirection parser
LOG_FILENAME = 'heroku-logs'
REQUEST_START_REGEX = /(.+)Started (.+) \"(.+)\"/
REDIRECT_REGEX = /(.+)Redirected to (.+barkibu.com)(.+)/
log_lines = File.readlines(LOG_FILENAME)
redirects = []
last_request = {}
log_lines.each do |line|
@esaborit4code
esaborit4code / rediparser.rb
Created June 10, 2016 12:06
Locale redirections parser
LOG_FILENAME = 'heroku-logs'
REQUEST_START_REGEX = /(.+)Started (.+) \"(.+)\"/
REDIRECT_REGEX = /(.+)Redirected to (.+barkibu.com)(.+)/
log_lines = File.readlines(LOG_FILENAME)
redirects = []
last_request = {}
log_lines.each do |line|