Skip to content

Instantly share code, notes, and snippets.

View tdantas's full-sized avatar
🏠
Working from home

Thiago Dantas tdantas

🏠
Working from home
View GitHub Profile
@max-mapper
max-mapper / bikethefts.topojson
Last active August 29, 2015 14:16
portland bike theft data, 2007-2014 (from https://github.com/oregonian/bikethefts)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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;
doc.save()
});
@soarez
soarez / ca.md
Last active April 15, 2024 12:20
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
soarez / pullall.sh
Last active December 17, 2015 12:39
update and link a folder of git versioned npm modules
#!/bin/bash
contents=`ls`
module_names=()
module_folders=()
npm_root=$(npm root -g)
do_pull=1
do_npm_install=1
do_npm_link=1
@aku
aku / gist:5466527
Created April 26, 2013 11:19
Example of Socket.io proxy config for NGINX (version 1.3.13+)
upstream backend {
server 127.0.0.1:3000;
}
server {
listen 80;
access_log /var/log/nginx/yoursite.access.log;
error_log /var/log/nginx/yoursite.error.log;
@bokmann
bokmann / ActiveRepository.rb
Created March 27, 2012 16:15
ActiveRepository Strawman
# 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
jacqui / gist:983051
Created May 20, 2011 14:43 — forked from pauldix/gist:981916
Redis SORT command examples
# Optimized for writes, sort on read
# LVC
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)
@briancavalier
briancavalier / tiny closure Promise.js
Created February 7, 2011 12:55
A closure version of my mod (https://gist.github.com/814313) to unscriptable's tiny promise (https://gist.github.com/814052/)
function Promise() {
var callbacks = [],
promise = {
resolve: resolve,
reject: reject,
then: then,
safe: {
then: function safeThen(resolve, reject) {
promise.then(resolve, reject);
}
@dshaw
dshaw / gist:378192
Created April 25, 2010 05:56 — forked from paulirish/gist:315916
(function(window,document,undefined){ ... })(this,this.document);
// 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.