Skip to content

Instantly share code, notes, and snippets.

View nanounanue's full-sized avatar
💭
😡

Adolfo De Unánue nanounanue

💭
😡
View GitHub Profile
class Users::SessionsController < Devise::SessionsController
# Have to reimplement :recall => "failure"
# for warden to redirect to some action that will return what I want
def create
resource = warden.authenticate!(:scope => resource_name, :recall => "failure")
# set_flash_message :notice, :signed_in
sign_in_and_redirect(resource_name, resource)
end
@nanounanue
nanounanue / main.Rnw
Created June 21, 2012 18:08 — forked from yihui/main.Rnw
use knit() with a loop to write reports for subsets of data
\documentclass{article}
\begin{document}
<<run-all, results='hide', message=FALSE>>=
library(xtable)
out = NULL
for (g in unique(mtcars$gear)) {
out = c(out, knit_child('template.Rnw', sprintf('gear-%s.tex', g)))
}
@nanounanue
nanounanue / table2plot.R
Created August 22, 2012 18:38 — forked from even4void/table2plot.R
A fake example for mixing text and graphic
display.cell <- function(x, bgcol="#DAE6F2", ...) {
opar <- par(bg=bgcol, mar=rep(0,4))
plot(c(0,1), c(0,1), type="n", axes=FALSE, xlab="", ylab="")
text(.5, .5, as.character(x), ...)
lines(c(-0.1,1.1), c(0,0))
par(opar)
}
format.digits <- function(x) as.character(paste("$", as.character(x), sep=" "))
@nanounanue
nanounanue / gist:3772627
Created September 23, 2012 18:41 — forked from rolo/gist:1481128
Install Postgres 9.1, PostGIS and create PostGIS template on Ubuntu 11.10 Oneiric Ocelot
#!/bin/bash
#
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
# http://wildfish.com
# add the ubuntu gis ppa
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get -y install build-essential openssl libreadline6 libreadline6-dev curl git-core \
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \
libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison
&&
\curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled
#! /bin/bash
# Author: Diego Valle-Jones
# Web: http://www.diegovalle.net
# Purpose: Download shapefiles of manzanas (blocks), agebs (census areas), ejes
# viales (streets), interesting areas and a whole bunch of other stuff
# Note that you'll need a recent version of innoextract
# http://constexpr.org/innoextract/, one that can work with files
# created by version 5.5 of Inno Setup, the one in Ubuntu universe is
# not recent enough. The version available at
#! /bin/bash
# Author: Diego Valle-Jones
# Web: http://www.diegovalle.net
# Purpose: Download the shapefiles contained in the Mapa Digital de México
# comunicaciones y transportes
# cultura
# curvas de nivel
# hidrografia
@nanounanue
nanounanue / zsh.md
Created July 16, 2013 03:41 — forked from tsabat/zsh.md
sudo apt-get -y install build-essential openssl libreadline6 libreadline6-dev curl git-core \
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \
libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison
&&
\curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled