Skip to content

Instantly share code, notes, and snippets.

Javier Blanco Gutiérrez jbgutierrez

Block or report user

Report or block jbgutierrez

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jbgutierrez
jbgutierrez / Default (Linux).sublime-keymap
Last active Sep 23, 2018
Sublime 2 Package - Property Extractor
View Default (Linux).sublime-keymap
[
{ "keys": ["alt+t"], "command": "extractor_command"}
]
@jbgutierrez
jbgutierrez / .eslintrc.js
Last active May 25, 2018
Distributing Work
View .eslintrc.js
module.exports = {
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module"
},
"rules": {
@jbgutierrez
jbgutierrez / index.js
Last active Jan 25, 2018
Hello World - Passport with LocalStrategy
View index.js
const express = require('express');
const passport = require('passport');
const app = express();
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const session = require('express-session');
const LocalStrategy = require('passport-local').Strategy;
passport.serializeUser((user, done) => { console.log('serialize'); done(null, user); } );
passport.deserializeUser((user, done) => { console.log('deserialize'); done(null, user); });
@jbgutierrez
jbgutierrez / app.js
Created Jun 28, 2017
Gestión de la configuración
View app.js
const config = require('./config');
console.log(config);
@jbgutierrez
jbgutierrez / Dict.coffee
Created Jun 16, 2017
Resolución de templates ejs
View Dict.coffee
class Dict
constructor: (@g, @dict) ->
@missings = []
resolve: (content, showErrors=true, json=false, englishFallback=true) ->
fail = false
RE = if json then /"\{([^}^\s]+)\}"/g else /\{([^}^\s]+)\}/g
content = content.replace RE, (m, n) =>
replacement = @t n, showErrors, true, englishFallback
fail or= not replacement?
@jbgutierrez
jbgutierrez / confirm.sh
Last active Mar 2, 2017 — forked from zeroasterisk/confirm.sh
confirm.sh a simple way to add confirmation to bash scripts
View confirm.sh
# ======================================================================
#
# @link http://wuhrr.wordpress.com/2010/01/13/adding-confirmation-to-bash/#comment-3540
#
# Function: confirm
# Asks the user to confirm an action, If the user does not answer "This won't shutdown the Internet!" the script will immediately exit.
#
# Parameters:
# $@ - The confirmation message
#
View ExecuteOnSave.sublime-settings
{
"filter_execute": {
"\\.coffee$": {
"cmd": "webpack-versioner.sh $file $file_path/versions.manifest.json",
"shell": true
}
},
"build_on_save": 1
}
@jbgutierrez
jbgutierrez / scss-lint.py
Created May 12, 2016
scss-lint with SublimeLinter in ST2
View scss-lint.py
import re
from base_linter import BaseLinter
CONFIG = {
'language': 'SCSS',
'executable': 'scss-lint.sh',
'lint_args': '{filename}'
}
@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
You can’t perform that action at this time.