Skip to content

Instantly share code, notes, and snippets.

View dharFr's full-sized avatar

Olivier Audard dharFr

View GitHub Profile
@dharFr
dharFr / jquery.unserialize-0.2.js
Created June 6, 2011 10:22 — forked from rcmachado/jquery.unserialize.js
$.unserialize [updated] for jQuery
/**
* $.unserialize
*
* Takes a string in format "param1=value1&param2=value2" and returns an object { param1: 'value1', param2: 'value2' }.
* If the "param1" ends with "[]" the param is treated as an array.
*
* Parses the value as String, Int or Boolean
* @todo: parseFloat could also be useful I guess.
*
* Example:
@dharFr
dharFr / upload-form.html
Created July 23, 2011 14:10
Asynschronous HTML File Upload (fake Ajax)
<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>
@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:
@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.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 / 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 / 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 / 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 / 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 / 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