Skip to content

Instantly share code, notes, and snippets.

View dharFr's full-sized avatar

Olivier Audard dharFr

View GitHub Profile
@dharFr
dharFr / Sample output
Created August 23, 2012 16:05
grailsenv - Dynamically switch your GRAILS_HOME
oaudard@work:~/Projects/sample-grails-project$ grailsenv
GRAILS_HOME=/home/oaudard/dev-utils/grails
grails
grails-1.3.7
grails-1.3.8
grails-2.0.0
grails-2.0.1
grails-2.0.3
grails-2.0.4
grails-2.1.0
@dharFr
dharFr / spock-whenthen.sublime-snippet
Created July 5, 2012 15:19
Sublime Text 2 snippet for basic 'when/then' Grails Spock test
<snippet>
<content><![CDATA[
def "${1:name your test}"() {
setup:
// setup your test
def l = [1, 2, 3]
when:
// test something
def r = l.findAll {it > 2}
then:
@dharFr
dharFr / readme.md
Created April 5, 2012 13:59
Grails run-app Helper

Grails run-app Helper

Launch 'grails run-app' with options:

-v | --grails-version  Specify grails version
-r | --remote-host     Run 'grails run-app' with -Dserver.host={your-ip} option
-p | --port            Run 'grails run-app' with -Dserver.port={value}
-h | --help            Display help

Setup

@dharFr
dharFr / jquery.queue.coffee
Created March 29, 2012 23:39
jQuery plugin used to queue $.Deferred's Promise objects
###*
* jQuery queue plugin v0.1
* ==========================
*
* Used to queue $.Deferred's Promise objects
* author @_dhar
###
(($) ->
@dharFr
dharFr / jquery.observer.js
Created February 28, 2012 00:39
jQuery based observer pattern
;(function($) {
/*
* jQuery Observer pattern
* inspired by @addyosmani 's code
* see: http://addyosmani.com/resources/essentialjsdesignpatterns/book/#highlighter_506612
*/
var topics = [];
function getTopic(id) {
var callbacks;
topic = id && topics[id];
@dharFr
dharFr / svn-rm-deleted.sh
Created February 20, 2012 17:17
Svn: how to remove all deleted files from repository?
# for more details, see: http://stackoverflow.com/questions/4608798/svn-how-to-remove-all-deleted-files-from-repository
svn st | grep '^!' | awk '{print $2}' | xargs svn delete --force
@dharFr
dharFr / extractURLParams.coffee
Created January 13, 2012 14:36
Simple CoffeeScript function to extracts parameters from URL
utils = utils || {}
utils.extractURLParams =->
params = window.location.search.substring(1).split "&"
result = {}
for param in params
strParam = param.toString()
sepPos = strParam.indexOf "="
key = strParam.substring 0, sepPos
@dharFr
dharFr / jquery.pinger-0.2.js
Created July 26, 2011 15:43
$.pinger : jQuery plugin for ping-URL process
/**
* $.pinger
*
* If your page runs into an iframe hosted by another domain, you may want to keep the session open.
* This plugin automates the "ping URL" process and provides some options.
*
* The pinger will ask the given URL every 'interval' minutes if it detects
* some activity by listening to the events listed in 'listen' parameter.
*
* Have a look to the 'defaults' variable below for further details about available parameters and default values.
@dharFr
dharFr / jquery.pluginName.coffee
Created July 23, 2011 14:28
jQuery Plugin pattern written in CoffeeScript (written from jQuery Doc: http://docs.jquery.com/Plugins/Authoring)
###*
* jQuery pluginName plugin v0.1
* ==========================
* see http://docs.jquery.com/Plugins/Authoring
*
* plugin description goes here
* author your.name@email.com
###
(($) ->
@dharFr
dharFr / jquery.helpbox.js
Created July 23, 2011 14:24
Simple jQuery plugin used to display contextual help
/**
* jQuery helpBox plugin v0.1
* ==========================
*
* http://www.dhar.fr
*
* Provides a simple way to add contextual help in your page.
* @author Olivier Audard - audard[AT]gmail[DOT]com
*
* Usage: