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
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) {
Please send us the following information:
1. the approximate date of a last purchase made to your Skype account (can be looked up from the credit card statement or from the confirmation email sent to you after the purchase)
2. The order number
3. The payment method or credit card type used to make a purchase
4. The email address that was entered during registration
@sgruhier
sgruhier / balloon.css
Created June 8, 2010 09:38
Demo page of CSS3 transform/transition with some JS
#ballon {
-webkit-transition: all .2s ease-in-out;
}
@sgruhier
sgruhier / gist:403002
Created May 16, 2010 17:03
URL for local sub-domains and/or locale from the domain name testing
If you want to test rails applications (or any web applications) locally with sub-domains and/or setting the locale
from the domain name as describe in Rails' guides
http://guides.rubyonrails.org/i18n.html#setting-the-locale-from-the-domain-name you have multiple options:
- Edit your /etc/hosts file, that sucks! you need admin access and you'll pollute. DO NOT DO THAT!
- Use passenger (and passenger pane if you are on Mac OS X), but you need to enter manually all aliases
in your apache/nginx config file. painfull
- use those URLs 127localhost.com and 127localhost.fr. DNS for all subdomains are setup to IP 127.0.0.1
Nothing to setup/modify locally, just: