Skip to content

Instantly share code, notes, and snippets.

View jpemberthy's full-sized avatar

Juan Pemberthy jpemberthy

View GitHub Profile
@jpemberthy
jpemberthy / foo.rb
Created January 16, 2012 22:23 — forked from febuiles/foo.rb
class Foo
foo = %w(a b c)
BAR = %w(a b c)
foo.each do |method|
define_method(method) { p method.upcase! }
end
BAR.each do |method|
define_method(method.upcase!) { p method }
@jpemberthy
jpemberthy / gist:1093744
Created July 19, 2011 21:18 — forked from leemcalilly/gist:1019409
Milestones | 3.1 App

Milestones

  • Includes All Features Critical to Launching 3.1 App

Milestone Estimations

July 1 - Completed Items

  • User profiles and sign up (includes welcome page)
  • Events
  • Blog
  • Partners
def sidebar_link(text, image, url)
img = image_tag(image, :class => "icon")
link = link_to(url) { img + text }
content_tag("li", link)
end
@jpemberthy
jpemberthy / gist:1058616
Created July 1, 2011 14:11 — forked from leemcalilly/gist:1019409
Milestones | 3.1 App

Milestones

  • Includes All Features Critical to Launching 3.1 App

Milestone Estimations

July 1 - Completed Items

  • User profiles and sign up (includes welcome page)
  • Events
  • Blog
  • Partners
var simplified = { visibility: 'simplified' };
var style = {
'minimal': [
{ featureType: 'all',
stylers: [{ visibility: 'off' }] },
{ featureType: 'water',
stylers: [{ hue: 0 }, { visibility: 'on' }, { lightness: 0 }, { saturation: 0 }] },
{ featureType: 'water', elementType: 'label', stylers: [simplified] },
@jpemberthy
jpemberthy / rails_3_1_beta_1_changes.md
Created May 31, 2011 20:57 — forked from ryanb/rails_3_1_rc4_changes.md
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 Beta 1

  • The -j option of the application generator accepts an arbitrary string. If passed "foo", the gem "foo-rails" is added to the Gemfile, and the application JavaScript manifest requires "foo" and "foo_ujs". As of this writing "prototype-rails" and "jquery-rails" exist and provide those files via the asset pipeline. Default is "jquery". [fxn]

  • jQuery is no longer vendored, it is provided from now on by the jquery-rails gem. [fxn]

  • Prototype and Scriptaculous are no longer vendored, they are provided from now on by the prototype-rails gem. [fxn]

  • The scaffold controller will now produce SCSS file if Sass is available [Prem Sichanugrist]

// This is a bit non-DRY
// XXX Check how to properly refactor.
var AxAutocompletes = function () {
// Javascript permite nesting. Es mejor que nada quede definido en la parte externa.
var split = function (val) { return val.split( /,\s*/ ); }
var extractLast = function (term) { return split(term).pop(); }
// lift del $.bind
def as_json(options={})
# TODO: users.count and rating_sum are generating way too may queries,
# we should do something about them.
{
:latitude => latitude,
:longitude => longitude,
:title => title,
:id => id,
:users => users.count,
:cap => distance_cap,
def create
@post = @huddle.posts.build(params[:post])
@post.user = current_user
deliver_post if @post.save
respond_with @post
end
private
require 'spec/runner/formatter/base_text_formatter'
require 'spec/runner/formatter/no_op_method_missing'
module Spec
module Runner
module Formatter
class ImmediateFailureFormatter < BaseTextFormatter
include NOOPMethodMissing
def example_failed(example, counter, failure)