Skip to content

Instantly share code, notes, and snippets.

Olivier Audard dharFr

Block or report user

Report or block dharFr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dharFr
dharFr / spock-whenthen.sublime-snippet
Created Jul 5, 2012
Sublime Text 2 snippet for basic 'when/then' Grails Spock test
View spock-whenthen.sublime-snippet
<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 Apr 5, 2012
Grails run-app Helper
View readme.md

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 Mar 29, 2012
jQuery plugin used to queue $.Deferred's Promise objects
View jquery.queue.coffee
###*
* jQuery queue plugin v0.1
* ==========================
*
* Used to queue $.Deferred's Promise objects
* author @_dhar
###
(($) ->
@dharFr
dharFr / jquery.observer.js
Created Feb 28, 2012
jQuery based observer pattern
View jquery.observer.js
;(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 Feb 20, 2012
Svn: how to remove all deleted files from repository?
View svn-rm-deleted.sh
# 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 Jan 13, 2012
Simple CoffeeScript function to extracts parameters from URL
View extractURLParams.coffee
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 Jul 26, 2011
$.pinger : jQuery plugin for ping-URL process
View jquery.pinger-0.2.js
/**
* $.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 Jul 23, 2011
jQuery Plugin pattern written in CoffeeScript (written from jQuery Doc: http://docs.jquery.com/Plugins/Authoring)
View jquery.pluginName.coffee
###*
* 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 Jul 23, 2011
Simple jQuery plugin used to display contextual help
View jquery.helpbox.js
/**
* 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:
@dharFr
dharFr / upload-form.html
Created Jul 23, 2011
Asynschronous HTML File Upload (fake Ajax)
View upload-form.html
<script language="javascript" type="text/javascript">
function formUploadCallback (result) {
console.log("Upload OK:", result);
alert('Upload OK');
}
</script>
<form target="upload_target" action="upload.php" enctype="multipart/form-data" method="post">
File: <input name="myfile" type="file" />
<input name="submitBtn" type="submit" value="Submit" />
</form>
You can’t perform that action at this time.