Skip to content

Instantly share code, notes, and snippets.

View elhoyos's full-sized avatar

Juan Hoyos elhoyos

View GitHub Profile
@elhoyos
elhoyos / LibraryLogsHomebrewconfig.log
Created May 25, 2012 16:10 — forked from amarchen/LibraryLogsHomebrewconfig.log
Failed to install gtk-doc due to xml-doc failure
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by gtk-doc configure 1.18, which was
generated by GNU Autoconf 2.65. Invocation command line was
$ ./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/gtk-doc/1.18 --disable-scrollkeeper --with-xml-catalog=/usr/local/etc/xml/catalog
## --------- ##
## Platform. ##
@elhoyos
elhoyos / Query.sql
Created May 29, 2012 20:41
Sort by two factors
-- Todos los artículos de 'RAFA' primero ordenados por serial y luego el resto de artículos ordenados igualmente por serial.
SELECT a.* FROM articulos a LEFT JOIN (SELECT 'RAFA' COLLATE utf8mb4_general_ci AS nombre) r on r.nombre = a.usuario
ORDER BY r.nombre DESC, serial
@elhoyos
elhoyos / gist:3056674
Created July 5, 2012 21:43
Dynamically load a Model
class_name = "publication".classify
the_class = Object.const_get(class_name)
# or
the_class = class_name.constantize
# get Publication
the_class.find(1)
# equal to
@elhoyos
elhoyos / gist:3085266
Created July 10, 2012 18:18
Reload nginx on WebFaction
$ pwd
/home/xxx/webapps/myapp/nginx
$ sbin/nginx -p /home/xxx/webapps/myapp/nginx/ -s reload
@elhoyos
elhoyos / knowledgemap.js
Created July 31, 2012 15:12 — forked from kamens/knowledgemap.js
Knowledge Map file for Constellation Knowledge blog post
function KnowledgeMapInitGlobals() {
window.KnowledgeMapGlobals = {
colors: {
blue: "#0080C9",
green: "#8EBE4F",
red: "#E35D04",
gray: "#FFFFFF"
},
@elhoyos
elhoyos / remove_branches.sh
Last active October 12, 2015 12:08 — forked from schacon/gist:942899
Delete all git branches that have been already merged into master
git branch -a --merged master | # merged to master
grep -v '>' | # branch pointers exception
grep -v 'master\|develop' | # exceptions
xargs -L1 | # get the first column
tee >(grep origin |
awk '{split($0,a,"/"); print a[3]}' |
xargs git push origin --delete) | # remove remotes
xargs git branch -d # remove local
@elhoyos
elhoyos / gist:4596488
Created January 22, 2013 17:29
Run specific rake test
> rake test TESTOPTS="-ntest_recursive_include_associations"
@elhoyos
elhoyos / README.md
Last active December 14, 2015 17:59 — forked from anonymous/README.md
@elhoyos
elhoyos / gist:5934722
Created July 5, 2013 14:00
Eager load resources to make the application model-inheritance-aware
# Model.subclasses will give you an empty array
Rails.application.eager_load!
# Now you can do Model.subclasses and it will retrieve its descendants
@elhoyos
elhoyos / gist:5975574
Created July 11, 2013 13:46
Working with vim registers
" show the registers
:reg
" save current line to k register
"kyy
" paste from k register
"kp
" append current line to k register