Skip to content

Instantly share code, notes, and snippets.

View dmarcelino's full-sized avatar

Dário dmarcelino

  • AppsCot
  • Lisbon, Portugal
View GitHub Profile
@rblalock
rblalock / dashboardController.js
Created October 21, 2011 19:10
Simple inheritance with CommonJS Modules and Titanium
/**
* Dashboard controller
*/
// Private
var api = require('parentcontroller');
api.load = function() {
Ti.API.info('Child load method fired');
};
@rblalock
rblalock / implementation.js
Created October 21, 2011 20:33
Simple inheritance with CommonJS Modules and Titanium Part 2
// Create the module
var controllerModule = require('dashboardController').boot(_params);
// Test to see if the parent controller's load method or dashboardController method fires
controllerModule.load();
// Test to see other properties
Ti.API.info(controllerModule.works);

Publishing an NPM package

Here's what I do when I publish an NPM package.

1: Make sure you're up to date

I always like to check what's going on in a repo before I do anything:

@dmarcelino
dmarcelino / .bashrc
Last active September 30, 2020 07:37 — forked from marioBonales/.bashrc
Custom .bashrc for ubuntu with git and kubernetes support
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@skyl
skyl / kwacros.py
Created February 1, 2012 05:03
Django Template macros with args and kwargs
#
# templatetags/kwacros.py - Support for macros in Django templates
#
# Based on snippet by
# Author: Michal Ludvig <michal@logix.cz>
# http://www.logix.cz/michal
#
# modified for args and kwargs by Skylar Saveland http://skyl.org
#
@dustinfarris
dustinfarris / Sharing Django Users and Sessions Across Projects
Created July 26, 2013 00:38
This is a dated document and may be improved on.
# Sharing Django Users and Sessions Across Projects
By Dustin Farris on 22 Feb 2012
This document describes how to share users created using Django's auth system with other
Django projects. It is not a hack; it simply makes use of the database router and
middleware system that Django comes with out of the box.
## Introduction
let child = require("child_process")
let source_map = require("source-map")
let SourceMapConsumer = source_map.SourceMapConsumer
let path = require("path")
var crypto = require('crypto');
module.exports = function(source, sourceMap) {
this.cacheable()
this.async()
var self = this
@lancejpollard
lancejpollard / cursor-position.js
Created September 22, 2012 07:24
Get Cursor Position in Terminal with Node.js
module.exports = function(callback) {
require('child_process').exec('./cursor-position.sh', function(error, stdout, stderr) {
callback(error, JSON.parse(stdout));
});
}
@gregplaysguitar
gregplaysguitar / folding_whoosh_backend.py
Last active May 14, 2022 15:09
Django-haystack Whoosh backend with character folding
# -*- coding: utf-8 -*-
"""
Whoosh backend for haystack that implements character folding, as per
http://packages.python.org/Whoosh/stemming.html#character-folding .
Tested with Haystack 2.4.0 and Whooch 2.7.0
To use, put this file on your path and add it to your haystack settings, eg.
@johanndt
johanndt / upgrade-postgres-9.3-to-9.5.md
Last active July 15, 2022 12:35 — forked from dideler/upgrade-postgres-9.3-to-9.4.md
Upgrading PostgreSQL from 9.3 to 9.5 on Ubuntu

TL;DR

Install Postgres 9.5, and then:

sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main