Skip to content

Instantly share code, notes, and snippets.

View juliomenendez's full-sized avatar

Julio Carlos Menendez juliomenendez

View GitHub Profile
@juliomenendez
juliomenendez / gist:1189497
Created September 2, 2011 18:54 — forked from voodootikigod/gist:1155790
PyCodeConf Ticket Give-away
Day job: Python developer at the pathology department of the University of Utah. Mostly doing bioinformatics.
Favorite Python project: Django
Favorite Conference: Google IO
Python Experience Level: between intermediate and expert. 4 years.
@juliomenendez
juliomenendez / gist:1195724
Created September 5, 2011 19:25
Show one post per author in WP
add_filter('posts_groupby', 'author_groupby');
function author_groupby($groupby)
{
global $wpdb;
$author_groupby = "{$wpdb->posts}.post_author";
if(preg_match("/$author_groupby/", $groupby)) {
// grouping we need is already there
@juliomenendez
juliomenendez / gist:1222225
Created September 16, 2011 14:23
Get an array with all the changesets on a Trac ticket
$('a.changeset').map(function(i, o) { s = String($(o).html()).match(/^\[(\d+)/); return s[1]; });
@juliomenendez
juliomenendez / gist:1608297
Created January 13, 2012 19:36
Emacs lisp code to get a Growl notification when a compilation is done.
(defun growl (title message)
(start-process "growl" " growl" "growlnotify" title "-a" "Emacs")
(process-send-string " growl" message)
(process-send-string " growl" "\n")
(process-send-eof " growl"))
(defun growl-compilation-result(buffer msg)
(if (string-match "^finished" msg)
(progn
(growl "Emacs compilation" "Compilation Successful :-)"))
@juliomenendez
juliomenendez / gist:1975554
Created March 5, 2012 00:02
Remove a path from git including its history
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch path/to/remove' --prune-empty -- --all
@juliomenendez
juliomenendez / gist:2637618
Created May 8, 2012 17:25
Example of JSON API for moonalice search
{
"meta": {
"query": "search terms from the user"
},
"objects": [
{
"nid": unique_id_for_this_item,
"type": 1, // 1 means this result is a show
"title": "Item title to show in the result view",
"mr_id": id of the item in mobilerider system,
@juliomenendez
juliomenendez / gist:3054939
Created July 5, 2012 17:07
Install matplotlib in Mac OS X
pip install -e git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib
;; Mumamo is making emacs >23.3 freak out:
(when (and (> emacs-major-version 23)
(> emacs-minor-version 3))
(eval-after-load "bytecomp"
'(add-to-list 'byte-compile-not-obsolete-vars
'font-lock-beginning-of-syntax-function))
)
@juliomenendez
juliomenendez / AnimatedRegion
Created February 8, 2013 23:26
Backbone.Marionette.Region extended to animate changing its content.
var AnimatedRegion = Backbone.Marionette.Region.extend({
show: function(view) {
var that = this;
this.ensureEl();
this.close();
view.on('close', function() {
that.$el.addClass('transparent'); });
$.when(view.render()).then(function() {
that.open(view);
#!/bin/bash
GEOGRAPHY=0
POSTGIS_SQL=postgis.sql
POSTGIS_SQL_PATH=/usr/local/Cellar/postgis/2.0.1/share/postgis
# For Ubuntu 8.x and 9.x releases.
if [ -d "/usr/share/postgresql-8.3-postgis" ]
then
POSTGIS_SQL_PATH=/usr/share/postgresql-8.3-postgis