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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Starting StaticAssetTest App</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
// Do ajax call to '/status' if we get 'Online' redirect | |
$.ajax({ | |
url: '/status', |
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
match 'status' => proc {|env| [200, {}, 'Online']} | |
match 'home' => proc {|env| [200, {}, 'It works!']} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Starting StaticAssetTest App</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$.ajax({ | |
url: '/status', | |
success: function(data) { |
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
# **Updates** | |
%w{body_labor refinish_labor frame_labor}.each do |rate| | |
%w{mean mathematical_mode lowest highest}.each do |method| | |
@result.send(rate).send(method) | |
end | |
end | |
# **Original** | |
%table |
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 ResultsHelper | |
def make_table_row_for(result, rate) | |
ret << [] | |
ret << content_tag(:tr) do | |
content_tag(:th, rate.to_s.humanize) | |
content_tag(:td) do | |
pretty_number_to_currency method(rate, [:mean, :mathematical_mode, :lowest, :highest]) | |
end | |
end | |
return ret.join("\n") |
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
[scott@server2 ~]$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 373 100 373 0 0 2442 0 --:--:-- --:--:-- --:--:-- 0 | |
mkdir: cannot create directory `/usr/local/rvm': Permission denied | |
bash: line 10: cd: /usr/local/rvm/src: No such file or directory | |
Cloning into rvm... | |
remote: Counting objects: 2635, done. | |
remote: Compressing objects: 100% (1364/1364), done. | |
remote: Total 2635 (delta 1566), reused 1685 (delta 797) |
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 TodoItem | |
# provide reader and setter for name and state | |
attr_accessor :name, :state | |
def initialize(name) | |
# store name | |
self.name = name | |
# set state to undone | |
self.state = false | |
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
Name of some item to do | |
Another items to do | |
IMPORTANT item | |
etc |
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 TodoList | |
attr_accessor :file | |
def load(file = 'todo.txt') | |
@file = file | |
@list = [] | |
# Check that file exists | |
if using_valid_file? | |
# read the file, create a list, create items, add them |
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 'TodoList' | |
class App | |
def self.file_choser | |
puts "Enter a filename to use:" | |
gets.chomp | |
end | |
def self.main | |
file = file_choser |
OlderNewer