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
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 / main.es6
Created Dec 11, 2015
ES6 Express Server
View main.es6
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 Oct 29, 2015
Conway's Game of Life in Ruby
View life.rb
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 Oct 29, 2015
Invoke shell scripts via web
View .htdigest
user:realm:fb6cb9e166c6c764ff2bdea12175a8aa
@jbgutierrez
jbgutierrez / watch
Last active Aug 29, 2015
Hire/fire a webpack watcher after detecting new files in the file system
View watch
#!/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 Oct 29, 2015
Lazy logging errors to bost performace
View lazy-logger.rb
# 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
View find-unused-css.rb
#!/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']
View frame.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head></head>
<body>
<script>
document.write(+new Date);
parent.leak();
</script>
@jbgutierrez
jbgutierrez / check-style-ejs.rb
Last active Aug 29, 2015
Tiny little scripts to lint scss and ejs files
View check-style-ejs.rb
# coding: UTF-8
require 'nokogiri'
require 'tempfile'
require 'json'
VALID_NODE_NAMES = %w[title a abbr acronym address applet area article aside audio b base basefont bdi bdo bgsound big blink blockquote body br button canvas caption center cite code col colgroup command data datalist dd del details dfn dir div dl dt em embed fieldset figcaption figure font footer form frame frameset h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins isindex kbd keygen label legend li link listing main map mark marquee menu meta meter nav nobr noframes noscript object ol optgroup option output p param plaintext pre progress q rp rt ruby s samp script section select small source spacer span strike strong style sub summary sup table tbody td textarea tfoot th thead time title tr track tt u ul var video wbr xmp]
class TidyHTML
class << self
def scan glob
You can’t perform that action at this time.