Skip to content

Instantly share code, notes, and snippets.

View gbedardsice's full-sized avatar

Gabriel Bédard Sicé gbedardsice

View GitHub Profile
@gbedardsice
gbedardsice / backbone.marionette.bubble-event.js
Created June 4, 2014 15:28
Backbone.Marionette Bubble Event
(function() {
'use strict';
/**
* Simple event bubbling callback generator.
* Usage:
*
* this.listenTo(view, 'some:event', Marionette.bubbleEvent('some:other:event'));
*
* @param {String} eventName The event name of the event triggered. Can be the
@gbedardsice
gbedardsice / polyfill.js
Created May 9, 2014 15:07
Function.prototype.bind - Underscore polyfill
if (!Function.prototype.bind) {
Function.prototype.bind = function() {
var args = _.toArray(arguments);
args.unshift(this);
return _.bind.apply(null, args);
}
}
# ~/.osx — http://mths.be/osx
###############################################################################
# General UI/UX #
###############################################################################
# Set computer name (as done via System Preferences → Sharing)
scutil --set ComputerName "mba-gbsice"
scutil --set HostName "mba-gbsice"
scutil --set LocalHostName "mba-gbsice"
@gbedardsice
gbedardsice / contains_accent.rb
Created October 21, 2012 19:06
Verifying if a ruby string contains one or more accents
# encoding: utf-8
class String
# The extended characters map used by contains_accent. The accented characters
# are coded here using their numerical equivalent to sidestep encoding issues.
# These correspond to ISO-8859-1 encoding.
ACCENTS_MAPPING = {
'E' => [200,201,202,203],
'e' => [232,233,234,235],
'A' => [192,193,194,195,196,197],