Skip to content

Instantly share code, notes, and snippets.

View bbhoss's full-sized avatar
🎯
Focusing

Preston bbhoss

🎯
Focusing
View GitHub Profile
# 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
def test_method_names_become_symbols
assert_equal __, Symbol.all_symbols.include?("test_method_names_become_symbols".to_sym)
end
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.
gem "cucumber-rails", :git => "git://github.com/alg/cucumber-rails.git"
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)
<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 %>