Skip to content

Instantly share code, notes, and snippets.

View ohvitorino's full-sized avatar

Bruno Pinto Vitorino ohvitorino

View GitHub Profile
@ohvitorino
ohvitorino / cartodb20_build.sh
Last active May 21, 2020 18:11 — forked from ericmagnuson/cartodb20_build.sh
CartoDB installation on Ubuntu 12.04
###################################
## CartoDB 2.0 Install [Working] ##
## Tested on Ubuntu 12.04 ##
###################################
sudo apt-get update
sudo apt-get safe-upgrade -y
# Install miscellaneous dependencies packages
sudo apt-get install -y git-core python-software-properties openmpi-bin libopenmpi-dev build-essential libxslt-dev zlib1g-dev ruby gems unzip
################################################
# This should install cartodb (development mode)
# in your Ubuntu 12.04 machine
################################################
#!/bin/bash
sudo apt-get update
sudo apt-get safe-upgrade -y
# git:// port might be closed
@ohvitorino
ohvitorino / upgrade_pg.sh
Last active August 29, 2015 14:00 — forked from ibussieres/upgrade_pg.sh
Upgrade PostgreSQL from 9.1 to 9.3
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3 -y
#In case of error on previous step
# sudo update-alternatives --remove postmaster.1.gz /usr/share/postgresql/9.1/man/man1/postmaster.1.gz
# sudo apt-get install -f
# sudo apt-get install --reinstall postgresql-9.1
@ohvitorino
ohvitorino / gist:db0e954d334db79f9f82
Last active August 29, 2015 14:14
PostgreSQL: freetds foreign data wrapper
apt-get install freetds-dev
apt-get install libsybdb5 freetds-dev freetds-common
apt-get install postgresql-server-dev-9.3
apt-get install git
git clone https://github.com/GeoffMontee/tds_fdw.git
cd tds_fdw/
apt-get install build-essential
PATH=/usr/lib/postgresql/9.3/bin/:$PATH USE_PGXS=1 make
PATH=/usr/lib/postgresql/9.3/bin/:$PATH USE_PGXS=1 make install
@ohvitorino
ohvitorino / csv-to-json.php
Created January 22, 2016 13:00 — forked from robflaherty/csv-to-json.php
Convert CSV to JSON
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
@ohvitorino
ohvitorino / pubsub.js
Created May 6, 2016 12:06 — forked from learncodeacademy/pubsub.js
Basic Javascript PubSub Pattern
//events - a super-basic Javascript (publish subscribe) pattern
var events = {
events: {},
on: function (eventName, fn) {
this.events[eventName] = this.events[eventName] || [];
this.events[eventName].push(fn);
},
off: function(eventName, fn) {
if (this.events[eventName]) {
@ohvitorino
ohvitorino / main.js
Last active May 6, 2016 12:36
Revealing Module Pattern in Javascript
var people = (function(){
var people = ['Will', 'Steve'];
//cache DOM
var $el = $('#peopleModule');
var $button = $el.find('button');
var $input = $el.find('input');
var $ul = $el.find('ul');
var template = $el.find('#people-template').html();
@ohvitorino
ohvitorino / classical_inheritance.js
Created May 6, 2016 14:16
Classical javascript inheritance
// Classical prototypal inheritance
// This function comes from Node.js
function inherits(ctor, superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
@ohvitorino
ohvitorino / prototypal_inheritance.js
Created May 6, 2016 14:27
Prototypal inheritance in javascript (new stuff)
//prototypal inheritance
var human = {
species: "human",
create: function(values) {
var instance = Object.create(this);
Object.keys(values).forEach(function(key) {
instance[key] = values[key];
});
return instance;
},
@ohvitorino
ohvitorino / Overview.txt
Created June 10, 2016 12:04 — forked from juneym/Overview.txt
Task Object, Coordination & Chain of Responsibility Design pattern
Overview:
This was an example I have given to my co-developer who was doing some Task/Coodinator type of code. Hope this is helpful to many other developers out there.
Note that the example only supports one-to-one dependency between TaskObject instance. The TaskAbstract class can be easily modified to support 1-to-many dependency.
For simpicity, I have combined all three classes in this single gist:
1. TaskAbstract
2. TaskObject (extends TaskAbstract)
3. TaskCoordinator (extends TaskAbstract)