This file contains 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 'coffee' | |
require 'water' | |
require 'cup' | |
require 'carsten' | |
cup = Cup.new(:size => 'small') | |
cup.add(Coffee::Espresso.new(:shots => 3)) | |
cup.add(Water::Ice.new(:cubes => 12)) | |
cup.join |
This file contains 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
$("body.entries #all_tags span").click(function() { | |
var thisTag = $(this).text(); | |
var indexOfThisTag = jQuery.inArray(thisTag, window.currentTags); | |
if (indexOfThisTag >= 0) { | |
window.currentTags.splice(indexOfThisTag, 1); | |
} else { | |
window.currentTags.push(thisTag); | |
} | |
$("#entry_tags_as_string").val(window.currentTags.join(", ")); | |
}); |
This file contains 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 FoosController < ApplicationController | |
def create | |
@foo = Foo.new(params[:foo]) | |
respond_to do |format| | |
if @foo.save | |
flash[:notice] = 'Foo was successfully created.' | |
format.html { redirect_to(@foo) } | |
format.xml { render :xml => @foo, :status => :created, :location => @foo } | |
else |
This file contains 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 LuckySneaks | |
module ActsAsUrl # :nodoc: | |
def self.included(base) | |
base.extend ClassMethods | |
end | |
module ClassMethods # :doc: | |
# Creates a callback to automatically create an url-friendly representation | |
# of the <tt>attribute</tt> argument. Example: | |
# |
This file contains 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 'test/unit' | |
begin | |
require File.dirname(__FILE__) + '/../../../config/environment' | |
rescue LoadError | |
require 'rubygems' | |
gem 'activerecord' | |
require 'active_record' | |
RAILS_ROOT = File.dirname(__FILE__) |
This file contains 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 User < ActiveRecord::Base | |
def merge(other) | |
%w{ | |
attribute_1 | |
attribute_2 | |
attribute_3 | |
attribute_4 | |
attribute_5 | |
attribute_6 | |
}.each do |attribute| |
This file contains 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
## Helper | |
# Used for the column that is the default sort | |
def default_sortable_header(column, order, text = nil) | |
column = column.to_s.downcase | |
order = order.to_s.downcase | |
opposite = order == "desc" ? "asc" : "desc" | |
text ||= column.humanize | |
query_string = "" | |
if params[:sort] | |
if params[:sort] == column |
This file contains 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
## Controller | |
# Calls with :order => order_with_default("documents.created_at", :desc) | |
private | |
def order_with_default(column, direction) | |
if params[:sort] | |
"#{params[:sort]} #{params[:direction]}, #{column} #{direction}" | |
else | |
"#{column} #{direction}" |
This file contains 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
Please confirm the upgrade from | |
%strong= Plan[session[:old_plan_id]] | |
to | |
%strong= Plan[session[:new_plan_id]] | |
%br | |
%br | |
You are upgrading your | |
%strong Orchestrate | |
account located at | |
%string |
This file contains 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 ActiveSupport | |
module CoreExtensions #:nodoc: | |
module String | |
module Conversions | |
def to_klass | |
self.classify.constantize | |
rescue NameError | |
nil | |
end | |
end |
OlderNewer