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
<h5>Tab 1</h5> | |
<!-- Tab 1 content Start --> | |
<div> | |
<p>Tab 1 content</p> | |
</div> | |
<!-- Tab 1 content end --> | |
<h5>Tab 2</h5> | |
<!-- Tab 2 content Start --> | |
<div> | |
<p>Tab 2 content</p> |
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
<h5>Description</h5> | |
<div> | |
[CONTENT HERE] | |
</div> | |
<h5>Features</h5> | |
<div> | |
[CONTENT HERE] | |
</div> |
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
<h5>Description</h5> | |
<div> | |
[CONTENT HERE] | |
</div> | |
<h5>Features</h5> | |
<div> | |
[CONTENT HERE] | |
</div> | |
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
#!/usr/bin/env bash | |
mate .autotest app/ features/ config/ lib/ db/ vendor/gems/ vendor/plugins/ public/ test/ spec/ Rakefile README; |
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 String | |
def to_name | |
firstname,middlename,lastname = nil,nil,nil | |
name = self | |
name_ary = name.split(" ") | |
if name_ary.size > 2 | |
firstname,middlename,lastname = name_ary[0],name_ary[1],name_ary[2..name_ary.size].join(" ") | |
else | |
firstname,lastname = name_ary[0],name_ary[1] | |
end |
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
def quicktime_movie(url, options = {}) | |
filename = url.scan(/\w+\.mov$/) | |
url.gsub!(filename) | |
object_tag_options = { | |
:CLASSID => "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B", | |
:width => "320", | |
:height => "256", | |
:codebase => "http://www.apple.com/qtactivex/qtplugin.cab" | |
}.update(options) | |
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 'rubygems' | |
begin | |
gem 'gem_name' | |
rescue LoadError | |
require 'gem_name' | |
end | |
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
#!/usr/bin/ruby | |
class Foo | |
attr_accessor :name, :age | |
def initialize | |
@options = {:name => "Tim", :age => 28} | |
end | |
def work(h) |
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
## app/controllers/users_controller.rb | |
class UsersController < ApplicationController::Base | |
def create | |
@user = User.new(params[:user]) | |
if @user.save | |
SomeMailer.deliver_activation_email(@user, self) # pass in the controller object | |
redirect_to some_path | |
end | |
end | |
end |
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
# Adds a convienence method to the Hash class | |
# Allows you to check if a hash has a valid key and value. | |
class Hash | |
def assert_valid_key?(key) | |
self.symbolize_keys.has_key?(key.to_sym) && !self[key].blank? | |
end | |
end | |
# Test it |
OlderNewer