Skip to content

Instantly share code, notes, and snippets.

View fonji's full-sized avatar
🤖
Happy Robot

Yannick Fonjallaz fonji

🤖
Happy Robot
View GitHub Profile

Keybase proof

I hereby claim:

  • I am fonji on github.
  • I am fonji (https://keybase.io/fonji) on keybase.
  • I have a public key whose fingerprint is F2D0 261F AAD2 F727 8194 EFF8 B1B4 6240 D53F 18A7

To claim this, I am signing this object:

@fonji
fonji / underscore.deep.defaults.js.coffee
Last active August 29, 2015 14:25
Underscore recursive _.defaults (deepDefaults)
# _.deepDefaults
# inspired by _.defaults but adds recursivity
# https://gist.github.com/fonji/dc279bbf23152d158fc4
#
# Example:
# _.deepDefaults(
# {bar: {a: 'a', c: 'c'}},
# {foo: 'foo', bar: {a: 'b', d:'d'}}
# )
# will result in
# _.deepWhere
# same as _.where but supports comparison of arrays as attributes
# https://gist.github.com/fonji/6c1895ed9b1cc2666128
#
# Example:
# _.deepWhere({foo: 'foo', bar: [{a: 'b'}]}, {bar: [{a: 'b'}]})
# Changelog:
# v0.1.0 creation (fonji)
# Returns whether an object has a given set of key:value pairs.
@fonji
fonji / ie8.date.toisostring.js
Last active August 29, 2015 14:15
IE8 Date.prototype.toISOString support.js
// https://gist.github.com/fonji/863b961ab83ae35c98fe
// From http://stackoverflow.com/questions/12907862/ie8-date-compatibility-error
if ( !Date.prototype.toISOString ) {
(function() {
function pad(number) {
var r = String(number);
if ( r.length === 1 ) {
r = '0' + r;
}
return r;
@fonji
fonji / select2.js
Last active June 22, 2016 08:19
select2 editor for Backbone-forms
/**
* Select2 editor for backboneforms
* https://gist.github.com/fonji/5f5a71cf247fcb9e4098
*
* Renders Select2 - jQuery based replacement for select boxes
* Based on:
* https://gist.github.com/jbugwadia/9303389
*
* Usage: Works the same as Select editor, with the following extensions for Select2:
* schema.config: configuration object passed to Select2