Technology Stack for Rails
Core
- Rails 3.0.1
- Ruby 1.9.2 (use RVM for mgmt.)
Development
- Bundler – manage gem dependencies
require 'open-uri' | |
require 'json' | |
require 'psych' | |
city = 'portsaid,egypt' | |
request = "http://api.openweathermap.org/data/2.5/weather?q=#{city}" | |
response = open(request).readlines.join | |
print Psych.dump( JSON.parse(response) ) |
package demo | |
// The Savable interface should be implemented by any resource associated with | |
// an Account that can be persisted. | |
type Savable interface { | |
Save(Account) (string, error) | |
} | |
// An Account ties together all records associated with a single client. | |
// |
# Easy download examples | |
# | |
# First example, downloads 10 files from the same server sequencially using the same | |
# easy handle with a persistent connection | |
# | |
# Second example, sends all 10 requests in parallel using 10 easy handles | |
# | |
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'ext'))) | |
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))) | |
require 'curb' |
source :rubygems | |
gem 'sinatra', '1.0' | |
gem 'oauth2' | |
gem 'json' | |
group :development do | |
gem 'shotgun' | |
end |
Technology Stack for Rails
Core
Development
source 'http://rubygems.org' | |
gem 'rails', '3.0.0' | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
#gem 'mysql2' | |
gem "sqlite3-ruby" |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>Bayeux / Comet Test for Tropo</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> | |
<script type="text/javascript" src="http://path/to/your/bayeaux/server/tropo.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() { |
$ rvm ruby-1.9.2-p136@ingredients | |
$ gem list | |
animalcracker (0.0.2) | |
bacon (1.1.0) | |
beet (0.6.9) | |
berry (0.0.0) | |
breadcrumbs (0.1.5) | |
butternut (0.2.1) |
Feature: Validate moves | |
Scenario: Moving the knight illegally | |
Given the following board: | |
| | | | | | | | |8| | |
| | | | | | | | |7| | |
| | | | | | | | |6| | |
| | | | | | | | |5| | |
| | | |♞| | | | |4| | |
| | | | | | | | |3| | |
|♙| | | | | | | |2| |
if defined?(::Bundler) | |
global_gemset = ENV['GEM_PATH'].split(':').grep(/ruby.*@global/).first | |
if global_gemset | |
all_global_gem_paths = Dir.glob("#{global_gemset}/gems/*") | |
all_global_gem_paths.each do |p| | |
gem_path = "#{p}/lib" | |
$LOAD_PATH << gem_path | |
end | |
end | |
end |