Skip to content

Instantly share code, notes, and snippets.

View jpemberthy's full-sized avatar

Juan Pemberthy jpemberthy

View GitHub Profile
javascript:void((function(){var%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://local.weheartit.com:3000/bookmarklet.js');e.setAttribute('id','whi-js-dev');document.body.appendChild(e)})());
# -*- coding: utf-8 -*-
module FormsHelper
def self.included(base)
ActionView::Base.default_form_builder = TwitterFormBuilder
end
class TwitterFormBuilder < ActionView::Helpers::FormBuilder
def legend(text)
content_tag :fieldset, content_tag(:legend, text)
# No es un poco más rápido sin el Date object?
# Crear un objeto cada vez es un poco feo.
# Sobre todo cuando es una función que se llama como 3mil veces
# Además, new Date(milisecs) es una mierda.
toHumanTime: ->
# date = new Date(@milliSeconds)
hours = Math.floor(@milliSeconds / (1000 * 60 * 60)) % 24
mins = Math.floor(@milliSeconds / (1000 * 60)) % 60 # date.getMinutes()
secs = Math.floor(@milliSeconds / (1000)) % 60 # date.getSeconds()
@leemcalilly
leemcalilly / gist:1019409
Created June 10, 2011 18:19
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
@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
@metaskills
metaskills / gist:977846
Created May 18, 2011 01:52
If your not returning ruby primitives and other objects that know how to respond to #as_json from #as_jons - Your doing it wrong.
class User < ActiveRecord::Base
has_many :columns
def as_json(options={})
attributes.slice(:id, :email, :uuid).merge(:columns => columns)
end
end
class Column < ActiveRecord::Base
belongs_to :user
has_many :boxes
Some extra bundles.
***
expect {
${1:something}
}.to change(${2:Thing}, ${3::attribute}).from(${4:a}).to(${5:b})
***
GBP FUND
Zulumaster 1
Currency Changers
Fly on the wall
PIP EMPORIUM
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwze+yik2n2RHJIEFhTnyJQAn4SKoZRoHkHFXfR+lMMuu5OkMn631F2NPdd0M0S9aN98n4C8i3kVLFwLZvDoeqXqK6YzACrWL29/KG/pjgskzUBo+7xhR3NID7fxbG8AwZmGBPT/wZJeUW/gE9PNQbEx1MotIsNG7lnUKQ91MtQ1ZZ5JO9TjjM8ODIcM0OsgkGj4Mj5HruRxm0syOLlcm4B827SygFoVZXQTHCYve1IvewmWV11Q3HNAUrH6W50DZa4ufugMO0x8Vse0R6b23kEj2Y2DZKh1VuVxQ0mSpOAp5WBSG0IdSSoToD75QLRmUy0RWyWfAa6GM2WOdhNFI1Q== jpemberthy@gmail.com