This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
helper :all | |
before_filter :set_global | |
before_filter :wadus, :except => [:index] | |
def wadus | |
@foo = "Oh my gosh!" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'smusher' | |
out = `smusher ./` | |
out.lines.each do |line| | |
line.gsub!("\n",'') | |
if line.include?("smushing") | |
system("git add #{line.gsub("smushing ",'')}") | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~$ irb | |
>> require 'open-uri' | |
=> true | |
>> foo = open("http://feeds.feedburner.com/walkaways") | |
=> #<StringIO:0xb7891c0c> | |
>> foo.each_line{ |l| puts l } | |
<?xml version="1.0" encoding="UTF-8"?> | |
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss version="2.0"><channel> | |
[...] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def what_changed(new) | |
attributes = Array.new | |
for attr in self.attribute_names | |
attributes.push(attr) unless (self.send(attr) == new.send(attr)) | |
end | |
attributes | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
“You can take a group of idiots that maybe even didn’t go to school, don’t understand computer science, don’t understand software development engineering techniques, hate each other, don’t understand the business domains, have lousy engineering tools and uniformly, they will produce CRAP every increment.“ | |
Ken Schwaber - “Scrum et al.“@ Google Tech Talks | |
Talking about Waterfall Vs SCRUM Software Development Process | |
¿Qué es "Agil"? | |
Individuals and interactions over processes and tools | |
Working software over comprehensive documentation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Event | |
has_many :attendings | |
has_many :attendees, :through => :attendings, :source => :user do |id| | |
# Esto es un poco oscuro pero se explica rápido: redefinimos el operador << para que | |
# al insertar un usuario en un evento, si previamente ya se encontraba apuntado al mismo | |
# se borre. | |
def <<(user) | |
attending = Attending.find_by_user_id_and_event_id(user.id, self.proxy_owner.id) | |
attending.blank? ? Attending.create(:user_id => user.id, :event_id => self.proxy_owner.id) : attending.destroy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Categorizable | |
def self.included(base) | |
base.has_many :audience_scopes, :as => :audienciable | |
base.has_many :audience_categories, :through => :audience_scopes | |
base.has_many :areas, :through => :audience_scopes | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NewsItem < ActiveRecord::Base | |
... | |
acts_as_categorizable | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NewsItem < ActiveRecord::Base | |
include Categorizable | |
... | |
acts_as_categorizable | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Categorizable | |
def self.included(base) | |
base.send :extend, ClassMethods | |
end | |
module ClassMethods | |
def acts_as_categorizable | |
has_many :audience_scopes, :as => :audienciable |
OlderNewer