Skip to content

Instantly share code, notes, and snippets.

View jose-lpa's full-sized avatar

José L. Patiño Andrés jose-lpa

View GitHub Profile
@reu
reu / pub-sub.js
Created April 9, 2013 01:51
node.js redis pub-sub example
var redis = require("redis")
, subscriber = redis.createClient()
, publisher = redis.createClient();
subscriber.on("message", function(channel, message) {
console.log("Message '" + message + "' on channel '" + channel + "' arrived!")
});
subscriber.subscribe("test");
@EmilStenstrom
EmilStenstrom / admin.py
Created February 12, 2013 10:32
Make values in raw_id_fields clickable...
# Example usage...
from admin_util import ImprovedModelForm
class DialogAdmin(ImprovedModelForm):
raw_id_fields = ("forum", "user", ...) # "forum" and "user" are ForeignKeys
...
@rla
rla / code.cpp
Created July 23, 2012 13:12
Sending JSON POST request with Qt
void SyncService::sync()
{
QUrl url(SYNC_URL);
QNetworkRequest request(url);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(finished(QNetworkReply*)),
@x-Code-x
x-Code-x / readme_install_node
Created April 30, 2012 20:52
Install npm node.js on Debian Squeeze / Wheezy / Linux Mint Debian Edition
#Quick cp from http://sekati.com/etc/install-nodejs-on-debian-squeeze
#
#Needed to install TileMill from MapBox
#
#Installs node.js which has npm bundled
#
#Build Dependencies
sudo apt-get update && apt-get install git-core curl build-essential openssl libssl-dev

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@revolunet
revolunet / views.py
Created February 3, 2011 17:04
add context to your django error pages
#
# by default, django 404 and 500 pages dont pass context to templates.
# as you almost *always* need context variables in your custom
# 404/500 templates, you might need MEDIA_URL for example
#
# you need to create a custom view for errors and register it in your urls.py
#
# in urls.py add :
#
# handler500 = handler404 = views.server_error
@asenchi
asenchi / python.pp
Created February 20, 2010 14:56
Puppet manifest for installing Python and modules using pip
# Copyright (c) 2010 Curt Micol <asenchi@asenchi.com>
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
# THE SOFTWARE IS PROVIDED 'AS IS' AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
@lwu
lwu / README
Created August 12, 2008 05:18
example code demonstrating Mapnik C++ API
This code snippet, modifed from Mpanik's rundemo.cpp (r727, license LGPL),
renders the State of California using USGS state boundaries data.
Here's a play-by-play (via https://lists.berlios.de/pipermail/mapnik-devel/2008-August/000679.html)
rundemo.cpp renders a map of Ontario/Quebec, and instead I wanted to draw a
map of California and its surrounding states.
I grabbed the data from the USGS in the form of "statesp020" (google it, or
browse through nationalatlas.gov) and first wanted to modify rundemo.py