Skip to content

Instantly share code, notes, and snippets.

View mcollina's full-sized avatar

Matteo Collina mcollina

View GitHub Profile
module VarAccessor
Sass::Script::Functions.send :include, self
def self.variables
@variables ||= {}
end
def self.set(values = {})
variables.merge! values
end
# app/concerns/let.rb
# Ripped from Rspec 2.0 beta.12
# I've found it so useful in Rspec, I made it into a module. Controller code with shared
# code seem to have a lot of use for this. For example, in inherited_resources, you would
# typically override model, parent, etc. to configure it. You would typically memomize it
# as well. With this, you can use a more compact let() syntax.
# (Note: This code will only work in Rails 3)
module Let
@cowboy
cowboy / HEY-YOU.md
Last active May 16, 2024 13:31
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
@netzpirat
netzpirat / 0_README.md
Created November 12, 2010 10:42
Continuous CoffeeScript testing with Guard and Jasmine

Continuous CoffeeScript testing with Guard and Jasmine

This Gist shows how to set up a Rails project to practice BDD with CoffeeScript, Guard and Jasmine. You can see this setup in action on Vimeo

  • Install Gems with Bundler with bundle install
  • Define your guards with mate Guardfile
  • Initialize Jasmine with bundle exec jasmine init
  • Configure Jasmine with mate spec/support/yasmine.ym
  • Start Guard with bundle exec guard
@guybrush
guybrush / nodeconf_2011.md
Created May 6, 2011 07:22
a list of slides from nodeconf 2011
@mcollina
mcollina / back.js
Created May 17, 2011 15:24
Sencha Touch Back Button Plugin
BackButton = Ext.extend(Ext.Button, {
ui: 'back',
text: 'Back',
hidden: true,
id: 'back',
handler: function() {
var dispatchOptions = this.backStack.pop();
Ext.dispatch(dispatchOptions);
if(this.backStack.length == 0) {
@cedmax
cedmax / LICENSE.txt
Last active September 25, 2015 23:08 — forked from 140bytes/LICENSE.txt
pub/sub custom events
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 cedmax <http://github.com/cedmax>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@thomasv314
thomasv314 / gist:1058944
Created July 1, 2011 17:00
NoMethodError: Undefined method 'deg2rad' for #<Class:0x0000>
class Listing < ActiveRecord::Base
set_table_name :Listing
scope :near, lambda{
|*args|
origin = *args.first[:origin]
if (origin).is_a?(Array)
origin_lat, origin_lng = origin
else
origin_lat, origin_lng = origin.latitude, origin.longitude
@kyoto
kyoto / coderwall.coffee
Created July 10, 2011 09:13
Coderwall Badge Script for Blogs (or any other Web Page)
# coderwall.coffee
# Display coderwall.com badges
username = "hermanjunge"
el = $(".coderwall")
$.getJSON "http://www.coderwall.com/#{username}.json?callback=?", (data) ->
el.empty()
for item in data.data.badges
$("<img>")
.attr(