Skip to content

Instantly share code, notes, and snippets.

View josecolella's full-sized avatar
📱
Comms Platform at Gusto

Jose Miguel Colella josecolella

📱
Comms Platform at Gusto
View GitHub Profile
@panuta
panuta / gist:1852087
Last active April 8, 2020 16:46
How to setup Django/Postgresql on OS X Mountain Lion using Homebrew

Command Line Tools for Xcode

Command line tools comes bundle with Xcode prior to 4.3 version. After 4.3, you need to install a separated command line tools yourself.

First, go to this url and login using Apple Developer account (Free to register)

https://developer.apple.com/downloads/index.action
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@hoffrocket
hoffrocket / parhttp.py
Created August 28, 2012 00:29
Python parallel http requests using multiprocessing
#!/usr/bin/env python
from multiprocessing import Process, Pool
import time
import urllib2
def millis():
return int(round(time.time() * 1000))
def http_get(url):
@mef
mef / pre-render.js
Last active May 20, 2022 16:56
proof-of-concept pre-rendering d3.js svgs on the server using node.js and jsdom module.
// pre-render d3 charts at server side
var d3 = require('d3')
, jsdom = require('jsdom')
, fs = require('fs')
, htmlStub = '<html><head></head><body><div id="dataviz-container"></div><script src="js/d3.v3.min.js"></script></body></html>'
jsdom.env({
features : { QuerySelector : true }
, html : htmlStub
, done : function(errors, window) {
@psi-4ward
psi-4ward / GridStream.js
Created October 22, 2013 11:28
NodeJS MongoDB-GridFS Video range stream example Lets your browser seek/jump wihin the video-playback.
var app = require('express')();
var GridStore = require('mongodb').GridStore;
var ObjectID = require('mongodb').ObjectID;
var MongoClient = require('mongodb').MongoClient;
var Server = require('mongodb').Server;
var dbConnection;
MongoClient.connect("mongodb://localhost:27017/ersatz?auto_reconnect", {journal: true}, function(err, db) {
dbConnection = db;
app.listen(3000);
@benmccormick
benmccormick / minimal.vim
Last active February 26, 2022 17:09
A minimal vimrc for new vim users
" A minimal vimrc for new vim users to start with.
"
" Referenced here: http://vimuniversity.com/samples/your-first-vimrc-should-be-nearly-empty
"
" Original Author: Bram Moolenaar <Bram@vim.org>
" Made more minimal by: Ben Orenstein
" Modified by : Ben McCormick
" Last change: 2014 June 8
"
" To use it, copy it to

Git Cheat Sheet

Commands

Getting Started

git init

or

@joepie91
joepie91 / functional.js
Last active February 16, 2021 05:12
Functional programming (map, filter, reduce) in bluebird
/* Double all numbers */
Promise.map([1, 2, 3], function(num) {
return num * 2;
}).then(function(numbers) {
console.log("The final list of numbers:", numbers);
//The final list of numbers: [ 2, 4, 6 ]
});
/* Remove all the odd numbers */
Promise.filter([1, 2, 3], function(num) {
@thgaskell
thgaskell / gist:5987fccbd8473b5ef78f
Last active September 21, 2018 02:49
Introduction to Sequelize Migrations

What are Migrations

Just like how we use Git to version control source code, we use migrations to manage the state of our database schemas.

I'm not really sure what that means...

Imagine you're working on project with another developer, and you're both tasked with creating a specific part of an event planning application. Let's say you are in charge of creating the Users and your friend is going to create the Events.

Let's say you and your friend divided the work in a way so that neither of you will have to to use each other's code to finish your tasks. While you're working on your part of the application, you only really need to touch the Users table when you are working with the database.

Before you begin

Make sure that the project you are in is a node project (it has a package.json) and you have already installed and initialized sequelize (npm install --save sequelize, sequelize init). Also make sure that your config.json file has the correct credentials to connect to your database.

@jsumners
jsumners / gist:e6b5d0a699f16ba980a3
Last active November 24, 2022 16:09 — forked from thgaskell/gist:5987fccbd8473b5ef78f
Introduction to Sequelize Migrations

What are Migrations

Just like how we use Git to version control source code, we use migrations to manage the state of our database schemas.

I'm not really sure what that means...

Imagine you're working on project with another developer, and you're both tasked with creating a specific part of an event planning application. Let's say you are in charge of creating the Users and your friend is going to create the Events.

Let's say you and your friend divided the work in a way so that neither of you will have to to use each other's code to finish your tasks. While you're working on your part of the application, you only really need to touch the Users table when you are working with the database.

Creating models and migrations