Skip to content

Instantly share code, notes, and snippets.

View jpcaruana's full-sized avatar

Jean-Philippe Caruana jpcaruana

View GitHub Profile
package org.agitude.fileutils
import java.io.File
import org.apache.commons.io.FileUtils
// Utility object for test purpose only
object DummyProject {
private val TMP_DIR = new File("tmp")
val WEB_PACKAGE = Package("org.agitude.web", "module1")
# Scavenged from Git 1.6.5.x contrib/completion/git_completion.bash
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
# returns text to add to bash PS1 prompt (includes branch name)
__gitdir ()
{
if [ -z "${1-}" ]; then
if [ -n "${__git_dir-}" ]; then
echo "$__git_dir"
elif [ -d .git ]; then
echo .git
@jpcaruana
jpcaruana / precompiler.rb
Created July 22, 2011 08:03 — forked from cacoco/precompiler.rb
Buildr Extension for precompiling JSP files.
module Precompiler
include Extension
first_time do
# Define task not specific to any projet.
desc 'Precompile jsps'
Project.local_task('precompile' => 'compile') { |name| "Precompiling #{name}" }
end
before_define do |project|
@jpcaruana
jpcaruana / redis_pubsub_demo.rb
Created November 22, 2011 14:42 — forked from pietern/redis_pubsub_demo.rb
How to create a web chat with ruby & redis (Pieter Noordhuis)
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@jpcaruana
jpcaruana / gist:2642747
Created May 9, 2012 07:42 — forked from mtnygard/gist:2254147
Books I recommended today
@jpcaruana
jpcaruana / gist:2956906
Created June 19, 2012 22:31 — forked from andhapp/gist:2231347
Extract emails from google account
# Gemfile
source "http://rubygems.org"
gem 'mechanize'
gem 'hpricot'
# Ruby code