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
routes.rb | |
map.term ':term', :controller => 'conference', :action => 'index' | |
index.rhtml | |
<% form_for :term, :url => { :controller => :conference, :action => :index }, :html => {:method => :get} do |f| %> | |
<input type="text" name="term" id="search" size="50" /> | |
<input type="submit" value="Submit" id="submit" /> | |
<% 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
public static string Test() | |
{ | |
return "abc"; | |
} |
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 HomeController < ApplicationController | |
def index() | |
post = Post.create({ | |
:title => 'John' | |
}) | |
post.save | |
@posts = Post.find(:all) | |
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
#!c:/ruby/bin/ruby.exe | |
require 'rubygems' | |
require 'rubygems/gem_runner' | |
require 'rubygems/exceptions' | |
def install(lib) | |
begin | |
Gem::GemRunner.new.run ['install', lib] | |
rescue Gem::SystemExitException => e | |
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
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<UsingTask | |
AssemblyFile="3rdParty\CodePlex.MSBuildTasks.dll" | |
TaskName="CodePlex.MSBuildTasks.RegexReplace"/> | |
<UsingTask | |
AssemblyFile="3rdParty\CodePlex.MSBuildTasks.dll" | |
TaskName="CodePlex.MSBuildTasks.Unzip"/> | |
<UsingTask | |
AssemblyFile="3rdParty\CodePlex.MSBuildTasks.dll" |
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 'net/http' => true | |
require 'uri' | |
res = Net::HTTP.post_form(URI.parse('http://gist.github.com/api/v1/xml/new'), { 'files[file1.rb]' => "puts 'Hello World!'", 'files[file2.rb]' => "puts 'Gists example'"}) | |
puts res.body | |
#http://gist.github.com/240755 |
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
str = "a%sb%sc%s" | |
str % ['_', '/', '.'] | |
=> "a_b/c." |
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 x() | |
yeild | |
end | |
x { puts 'abc' } |
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
s = "test 'a' and 'b' and 'c'" | |
arguments = s.scan /'\w+'/ | |
=> ["'a'", "'b'", "'c'"] |
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
targets 1,2,3,4 | |
def targets(*targets) | |
@targets=[targets] | |
end | |
@targets | |
=> [1,2,3,4] |
OlderNewer