Skip to content

Instantly share code, notes, and snippets.

View sgruhier's full-sized avatar

Sébastien Gruhier sgruhier

  • https://xilinus.com
  • Saint-Paul en Forêt
  • X @sgruhier
View GitHub Profile
@sgruhier
sgruhier / Guardfile
Created September 8, 2012 14:45
Quick (and dirty) Guardfile for CoffeeScriptRedux and SourceMap
DEBUG = 1
module ::Guard
class Coffee < Guard
DEFAULT_OPTIONS = {compiler: 'coffee', input: 'coffee', output: 'js'}
def initialize(watchers = [], options = {})
watchers = [] if !watchers
defaults = DEFAULT_OPTIONS.clone
if options[:input]
<body>
<article>
<h1 class="fixie"></h1>
<p> Check us out at <a class="fixie"></a>,
and don't forget to view source.</p>
<section class="fixie">
<p></p>
<img/>
<ul></ul>
<p></p>
class MyView extends Backbone.View
constructor: ->
super
# Votre code ....
var marker = addresspickerMap.addresspicker( "marker");
var map = addresspickerMap.addresspicker( "map");
google.maps.event.addListener(marker, 'click', function() {
var infowindow = new google.maps.InfoWindow({content: "bla bla bla"})
infowindow.open(map,marker);
});
});
@sgruhier
sgruhier / liquid.rb
Created September 21, 2011 07:06
Rails 3.1 version of extra/liquid_view.rb of liquid markup gem
class LiquidHandler
PROTECTED_ASSIGNS = %w( template_root response _session template_class action_name request_origin session template
_response url _request _cookies variables_added _flash params _headers request cookies
ignore_missing_templates flash _params logger before_filter_chain_aborted headers )
def self.call(template)
new.compile(template)
end
def compile(template)
@sgruhier
sgruhier / gist:1086231
Created July 16, 2011 10:14
override jquery UI widget method
// If you dont need to call original method
$.widget("ui.addresspicker", $.extend({}, $.ui.addresspicker.prototype, {
_updatePosition: function(){
// Do what you want to
}
}));
// If you need to call original method
var _updatePosition = $.ui.addresspicker.prototype._updatePosition;
$.widget("ui.addresspicker", $.extend({}, $.ui.addresspicker.prototype, {
# Extend jQuery objects with Underscore collection methods.
#
# Each collection method comes in two flavors: one prefixed
# with _, which yields a bare DOM element, and one prefixed
# with $, which yields a jQuery-wrapped element.
#
# So if `this` is a jQuery object, instead of:
#
# _.max @, (el) -> $(el).height()
#
Some brief instructions on how to use Sprocket 2 in Rails to get CoffeeScript
powered JS and SASS powered CSS with YUI compression all via the magic of rack.
This stuff will be native in Rails 3.1 and the layout of the files on the
filesystem will be different but this guide will get you working with it
while we wait for all that to finalize.
Ignore the number prefixes on each file. This is just to ensure proper order in the Gist.
It's based on eric1234 gist https://gist.github.com/911003. ijust made it 3.1 compliant in terms of convention
Acceptance test with devise signup with stub for omniauth
window.SplitView = Backbone.View.extend({
el: $(document.body),
// Delegated mouse down events
events: {
"mousedown .vsplit": "mouseDownVSplit",
"mousedown .hsplit": "mouseDownHSplit"
},
initialize: function(element) {