Skip to content

Instantly share code, notes, and snippets.

Working from home

Thiago Dantas tdantas

Working from home
View GitHub Profile
maxogden / bikethefts.topojson
Last active Aug 29, 2015
portland bike theft data, 2007-2014 (from
View bikethefts.topojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View middleware.js
module.exports = function(connection){
return {
thumb: function(doc){
if(doc.thumbnails) return;
var Thumbnal = connection.model('Thumbnail');
Thumbnail.generate(doc.url, function(err, thumb){
doc.thumbnails = thumb;
soarez /
Last active Jan 3, 2022
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

soarez /
Last active Dec 17, 2015
update and link a folder of git versioned npm modules
npm_root=$(npm root -g)
aku / gist:5466527
Created Apr 26, 2013
Example of proxy config for NGINX (version 1.3.13+)
View gist:5466527
upstream backend {
server {
listen 80;
access_log /var/log/nginx/yoursite.access.log;
error_log /var/log/nginx/yoursite.error.log;
bokmann / ActiveRepository.rb
Created Mar 27, 2012
ActiveRepository Strawman
View ActiveRepository.rb
# MOTIVATION: As rails apps are growing, people are noticing the drawbacks
# of the ActiveRecord pattern. Several apps I have seen, and several
# developers I have spoken to are looking towards other patterns for object
# persistence. The major drawback with ActiveRecord is that the notion
# of the domain object is conflated with what it means to store/retrieve
# it in any given format (like sql, json, key/value, etc).
# This is an attempt to codify the Repository pattern in a way that would
# feel comfortable to beginner and seasoned Ruby developers alike.
jacqui / gist:983051
Created May 20, 2011 — forked from pauldix/gist:981916
Redis SORT command examples
View gist:983051
# Optimized for writes, sort on read
redis.hset("bonds|1", "bid_price", 96.01)
redis.hset("bonds|1", "ask_price", 97.53)
redis.hset("bonds|2", "bid_price", 95.50)
redis.hset("bonds|2", "ask_price", 98.25)
redis.sadd("bond_ids", 1)
redis.sadd("bond_ids", 2)
View tiny closure Promise.js
function Promise() {
var callbacks = [],
promise = {
resolve: resolve,
reject: reject,
then: then,
safe: {
then: function safeThen(resolve, reject) {
promise.then(resolve, reject);
dshaw / gist:378192
Created Apr 25, 2010 — forked from paulirish/gist:315916
(function(window,document,undefined){ ... })(this,this.document);
View gist:378192
// everyone's new favorite closure pattern:
(function(window,document,undefined){ ... })(this,this.document);
// when minified:
(function(w,d,u){ ... })(this,this.document);
// which means all uses of window/document/undefined inside the closure
// will be single-lettered, so big gains in minification.
// it also will speed up scope chain traversal a tiny tiny little bit.