Skip to content

Instantly share code, notes, and snippets.

View jbgutierrez's full-sized avatar

Javier Blanco Gutiérrez jbgutierrez

View GitHub Profile
@jbgutierrez
jbgutierrez / propuesta.txt
Created April 27, 2016 10:35
Propuesta de nombrado de claves de localización
// 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
@jbgutierrez
jbgutierrez / app.coffee
Created April 3, 2016 16:36
Mailing Service
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
#!/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 December 29, 2015 10:46
Migrate Things tasks to Asana
#!/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 / main.es6
Created December 11, 2015 00:28
ES6 Express Server
import express from "express"
var app = express();
app.get("/", (req, res) => {
res.json({hello: 'world'});
});
var port = process.env.PORT || 3000;
@jbgutierrez
jbgutierrez / life.rb
Last active October 29, 2015 20:59
Conway's Game of Life in Ruby
board = """
........................o...........
......................o.o...........
............oo......oo............oo
...........o...o....oo............oo
oo........o.....o...oo..............
oo........o...o.oo....o.o...........
..........o.....o.......o...........
...........o...o....................
............oo......................
@jbgutierrez
jbgutierrez / .htdigest
Last active October 29, 2015 21:08
Invoke shell scripts via web
user:realm:fb6cb9e166c6c764ff2bdea12175a8aa
@jbgutierrez
jbgutierrez / watch
Last active August 29, 2015 14:25
Hire/fire a webpack watcher after detecting new files in the file system
#!/usr/bin/env coffee
os = require 'os'
chokidar = require './nosync/node_modules/chokidar'
spawn = require('child_process').spawn
watcher = null
debounce = (fn, delay=100) ->
timer = null
->
context = this
@jbgutierrez
jbgutierrez / lazy-logger.rb
Last active October 29, 2015 21:10
Lazy logging errors to bost performace
# Meassure the difference:
# $ ab -r -n 10 http://127.0.0.1:4567/ | grep "Requests per second"
require 'sinatra'
require 'logger'
ERRLOG = Logger.new "#{__FILE__}.err"
ERRQ = Queue.new
Thread.new do
loop do
@jbgutierrez
jbgutierrez / find-unused-css.rb
Created May 14, 2015 12:00
Linting scss files
#!/usr/bin/env ruby
# coding: UTF-8
require 'deadweight'
dw = Deadweight.new
dw.stylesheets = ["public/css/application.css"]
ignore_selectors = %w[.icon.* #modal-itx]
dw.ignore_selectors = Regexp.compile "(#{ignore_selectors.join('|')})"
dw.root = File.dirname(__FILE__) + '/'
dw.pages = Dir['views/**/*.dust']