Skip to content

Instantly share code, notes, and snippets.

View rubenvarela's full-sized avatar

Rubén Varela rubenvarela

View GitHub Profile
@rubenvarela
rubenvarela / gist:8475772
Created January 17, 2014 15:54
Listado de Municipios de Puerto Rico en orden alfabético / List of Puerto Rico Municipalities in alphabetical order
Adjuntas
Aguada
Aguadilla
Aguas Buenas
Aibonito
Arecibo
Arroyo
Añasco
Barceloneta
Barranquitas
@rubenvarela
rubenvarela / flat_puerto_rico_municipalities
Created January 22, 2014 15:13
Listado de Municipios de Puerto Rico en orden alfabético, con espacios reemplazados por (_), todas minusculas, sin acentos y sin ñ's / List of Puerto Rico Municipalities in alphabetical order, spaces replaced with underscores (_), all lowercase and without any accent or ñ's.
adjuntas
aguada
aguadilla
aguas_buenas
aibonito
arecibo
arroyo
anasco
barceloneta
barranquitas
@rubenvarela
rubenvarela / gist:8560399
Created January 22, 2014 15:14
Merge between the flat list of puerto municipalities and the correct spelling separated by a pipe (|)
adjuntas|Adjuntas
aguada|Aguada
aguadilla|Aguadilla
aguas_buenas|Aguas Buenas
aibonito|Aibonito
arecibo|Arecibo
arroyo|Arroyo
anasco|Añasco
barceloneta|Barceloneta
barranquitas|Barranquitas
@rubenvarela
rubenvarela / gist:11332904
Created April 26, 2014 22:31
JS to remove accents in spanish including "diéresis"
accentsTidy = function(s){
var r=s.toLowerCase();
r = r.replace(new RegExp(/\s/g),"");
r = r.replace(new RegExp(/[á]/g),"a");
r = r.replace(new RegExp(/[é]/g),"e");
r = r.replace(new RegExp(/[í]/g),"i");
r = r.replace(new RegExp(/ñ/g),"n");
r = r.replace(new RegExp(/[ó]/g),"o");
r = r.replace(new RegExp(/[úü]/g),"u");
return r;
@rubenvarela
rubenvarela / Git links.md
Last active August 29, 2015 14:06
List of Git resources. Tutorials, Workflows and other things I might find interesting.
@rubenvarela
rubenvarela / cs_known_hosts
Last active June 28, 2017 19:15
Purdue CS cleaned known hosts
#Extracted from https://www.cs.purdue.edu/resources/facilities/remote-access/ssh_known_hosts2
#removed the key part using searching for ssh-(.*)\n and replacing with \n
# Since the only part I removed was the key, we can asume all the hosts per line identify the same host.
adenine,adenine.cs,adenine.cs.purdue.edu,128.10.8.25
adenine,adenine.cs,adenine.cs.purdue.edu,128.10.8.25
airfix,airfix.cs,airfix.cs.purdue.edu,128.10.2.171
airfix,airfix.cs,airfix.cs.purdue.edu,128.10.2.171
akula,akula.cs,akula.cs.purdue.edu,128.10.8.48
akula,akula.cs,akula.cs.purdue.edu,128.10.8.48
@rubenvarela
rubenvarela / gist:00e8ecffc9744110b5df
Created June 27, 2015 20:09
programmerexcuses.com Snapshot
Actually, that's a feature
Did you check for a virus on your system?
Don't worry, that value is only wrong half of the time
Even though it doesn't work, how does it feel?
Everything looks fine my end
How is that possible?
I broke that deliberately to do some testing
I can have a look but there's a lot of if statements in that code!
I can't make that a priority right now
I can't test everything
@rubenvarela
rubenvarela / CacheBuster.js
Last active February 27, 2018 23:37
Bookmarklet to add or increase a query string by 1 (cachebuster). Useful when using caching layers that respect query strings (Cloudflare, Varnish)
javascript:void((function () {
var uri = location.href;
var key = "cachebuster";
var re = new RegExp("([?&])" + key + "=(.*)?(&|$)", "i");
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
var matches = uri.match(re);
if (matches) {
location.href = uri.replace(re, '$1' + key + "=" + String(parseInt(matches[2])+1) + '$3');
@rubenvarela
rubenvarela / up
Created July 2, 2018 23:12 — forked from mayel/up
up - script to keep your Mac up-to-date (OS, Homebrew, and App Store updates) via the command line
#!/bin/sh
# up - v2 - script to keep your Mac up-to-date (OS, Homebrew, and App Store updates) via the command line
# run thus to to install: cd /usr/local/bin && curl -s -O https://gist.githubusercontent.com/mayel/c07bc0acb91824501d5bdbdc9eb7b33a/raw/08821f64c067327ea68a1a817eb43657db10f10e/up && chmod 755 /usr/local/bin/up
# and then run it anytime by simply entering the command: up
# By https://github.com/mayel based on a script by https://github.com/imwally
# homebrew
@rubenvarela
rubenvarela / gist:de82dfd08c013d27cb9753aa102922ce
Last active July 29, 2019 23:11 — forked from trongthanh/gist:2779392
How to move a folder from one repo to another and keep its commit history
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html
# First of all you need to have a clean clone of the source repository so we didn't screw the things up.
git clone git://server.com/my-repo1.git
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command
git filter-branch --subdirectory-filter your_dir -- -- all
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command.