Skip to content

Instantly share code, notes, and snippets.

Avatar

Javier Blanco Gutiérrez jbgutierrez

View GitHub Profile
@jbgutierrez
jbgutierrez / propuesta.txt
Created Apr 27, 2016
Propuesta de nombrado de claves de localización
View propuesta.txt
// ahora
diccionarios = [channel_][territory_]language
templates = [channel_][territory_]language
configuraciones = [channel_]territory[_language]
// propuesta
The locale naming convention is:
language[_territory][.codeset][@modifier]
where a two-letter language code is from ISO 639, a two-letter territory code is
from ISO 3166, codeset is the name of the codeset that is being used in the
View app.coffee
express = require 'express'
skipper = require 'skipper'
nodemailer = require 'nodemailer'
app = express()
verifyToken = (req, res, next) ->
token = req.body.token || req.query.token || req.headers['x-access-token']
if token is process.env.TOKEN
next()
else
View jruby+jdbc.rb
#!/usr/bin/env ruby
# coding: UTF-8
require "./db2jcc4.jar"
require "./db2jcc_license_cu.jar"
query = <<-eos
select 'hello' as foo, 'world' as bar
from sysibm.sysdummy1
eos
@jbgutierrez
jbgutierrez / export-todos.rb
Last active Dec 29, 2015
Migrate Things tasks to Asana
View export-todos.rb
#!/usr/bin/env ruby
# coding: UTF-8
require "logger"
require "pp"
require "yaml"
require "active_support/inflector"
logger = Logger.new $stderr
logger.level = Logger.const_get ENV.fetch "LOG_LEVEL", "INFO"
@jbgutierrez
jbgutierrez / setup-continuous-deployment-ubuntu-12.10-x86_64.sh
Last active Dec 27, 2015
Self-contained bash script to setup continuous deployment for nodejs apps built on top of ubuntu, git and foreman
View setup-continuous-deployment-ubuntu-12.10-x86_64.sh
DEPLOYER='deployer'
DEPLOYER_HOME="/home/$DEPLOYER"
PROJECT_NAME='node-js-sample'
PROJECT_REPO='https://github.com/heroku/node-js-sample.git'
# Provisining an ubuntu server
apt-get -y update
apt-get -y upgrade
apt-get -y install software-properties-common
add-apt-repository ppa:chris-lea/node.js
View mental-mapping-code-smell.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Mental mapping code smell</title>
<style>
.language-flag {
float: left;
}
</style>
@jbgutierrez
jbgutierrez / git-svn-relocate.sh
Created Aug 29, 2013
Rewriting Git History: Relocating Subversion URLs (http://goo.gl/OgudcR)
View git-svn-relocate.sh
#!/bin/sh
# Must be called with two command-line args.
# Example: git-svn-relocate.sh http://old.server https://new.server
if [ $# -ne 2 ]
then
echo "Please invoke this script with two command-line arguments (old and new SVN URLs)."
exit $E_NO_ARGS
fi
@jbgutierrez
jbgutierrez / draw_bounding_box.cpp
Created Jul 5, 2013
Drawing a bounding box around the detected contours of an image
View draw_bounding_box.cpp
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <algorithm>
#include <iostream>
#include <iterator>
#include <stdio.h>
#include <stdlib.h>
using namespace cv;
using namespace std;
@jbgutierrez
jbgutierrez / gist:5764369
Created Jun 12, 2013
Harmony Generators vs Promisses Libs
View gist:5764369
var step = 0;
async.waterfall([
function (next){
step = 1;
getJson('/country', function(data) { next(null, data); });
},
function (country, next){
step = 2;
getJson('/weather', function(data) { next(null, country, data); });
@jbgutierrez
jbgutierrez / EJSRenderer.java
Last active Dec 17, 2015
Java + EJS + I18n
View EJSRenderer.java
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import org.apache.commons.lang.StringEscapeUtils;
import org.codehaus.jackson.map.ObjectMapper;
import java.io.ByteArrayOutputStream;