This file contains hidden or 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
<h1>Register</h1> | |
<% form_for(@user) do |f| %> | |
<%= f.error_messages %> | |
<% f.fields_for :person do |g| %> | |
<p> | |
<%= g.label :firstname %><br /> | |
<%= g.text_field :firstname %> | |
</p> | |
<% end %> |
This file contains hidden or 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 'bigdecimal' | |
#Set values to determine output based on how much % of memory is free | |
CRITICAL=5 | |
WARNING=10 | |
File.open "/proc/meminfo","r" do |line| | |
@memtotal = BigDecimal.new($1) if line.gets =~ /MemTotal:\s+(\d+)\s+kB/ | |
@memfree = BigDecimal.new($1) if line.gets =~ /MemFree:\s+(\d+)\s+kB/ | |
end | |
if @memtotal and @memfree | |
@free_percentage = ((@memfree/@memtotal)*100) |
This file contains hidden or 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
gem "cucumber-rails", :git => "git://github.com/alg/cucumber-rails.git" |
This file contains hidden or 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
MyApplicationName::Application.configure do | |
# Edit at your own peril - it's recommended to regenerate this file | |
# in the future when you upgrade to a newer version of Cucumber. | |
# IMPORTANT: Setting config.cache_classes to false is known to | |
# break Cucumber's use_transactional_fixtures method. | |
# For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165 | |
config.cache_classes = true | |
# Log error messages when you accidentally call methods on nil. |
This file contains hidden or 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 test_method_names_become_symbols | |
assert_equal __, Symbol.all_symbols.include?("test_method_names_become_symbols".to_sym) | |
end |
This file contains hidden or 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
# event.rb | |
def format_day | |
self.day.strftime("%B %d, %Y (%A)") | |
end | |
def day_types | |
OpenStruct.new(:day => self.day, :format => self.format_day) | |
end | |
# view |
This file contains hidden or 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
Blog::Application.routes.draw do | |
get "pages/about" | |
get "pages/contact" | |
resources :portfolios | |
resources :links | |
resources :posts do |
This file contains hidden or 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
# | |
# Author:: Preston Marshall (<[email protected]>) | |
# License:: Apache License, Version 2.0 | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains hidden or 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 Local | |
def method_missing(*args) | |
"hello world" | |
end | |
end | |
def my_val | |
raise "goodbye cruel world" | |
end |
This file contains hidden or 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
calcBMI :: Float -> Float -> Float | |
calcBMI heightIn weightLbs = (weightLbs*703)/heightIn^2 | |
main = do | |
putStrLn "What is your weight in pounds?" | |
weight <- readLn :: IO Float | |
putStrLn "What is your height in inches?" | |
height <- readLn :: IO Float | |
putStrLn ("Your weight is " ++ show weight ++ "lbs. and your height is " ++ show height ++ "in.") | |
putStrLn ("Your BMI is " ++ show(calcBMI height weight)) |
OlderNewer