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
Usage Device name | |
11.4% CPU use | |
100.0% Audio codec hwC0D0: Realtek | |
100.0% Display backlight | |
100.0% Display backlight | |
100.0% PCI Device: Intel Corporation 2nd Generation Core Processor Family DRAM Controller | |
100.0% USB device: EHCI Host Controller | |
100.0% Radio device: asus-nb-wmi | |
100.0% USB Device: usb-device-8087-0024 | |
100.0% USB device: USB Receiver (Logitech) |
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
= form_for @card do |f| | |
-if @card.errors.any? | |
#error_explanation | |
%h2= "#{pluralize(@card.errors.count, "error")} prohibited this card from being saved:" | |
%ul | |
- @card.errors.full_messages.each do |msg| | |
%li= msg | |
.field | |
= f.label :card_name |
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 Card < ActiveRecord::Base | |
attr_accessor :card_name, :card_type | |
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
def titleize(word) | |
words = [] | |
result = "" | |
words = word.split | |
num = words.count | |
while num > 0 | |
words.each do |word| | |
word.capitalize! | |
result << word | |
result << " " unless num <= 1 |
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 titleize(word) | |
title = "" | |
words = word.split | |
words.each do |w| | |
if words.first == w | |
w.capitalize! | |
title << w | |
title << " " unless w == words.last | |
else | |
w.capitalize! unless ["a", "and", "the", "over"].include?(w.downcase) |
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 translate(word) | |
@word = word.to_s | |
result = "" | |
if word[0].include?(%w{a e i o u}) | |
result << @word + "ay" | |
end | |
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
def translate(word) | |
word_list = word.split(/ /) | |
letters = ('a'..'z').to_a | |
vowels = ['a', 'e', 'i', 'o', 'u'] | |
consonants = letters - vowels | |
result = "" | |
word_list.each do |word| | |
if vowels.include?(word[0]) | |
result << word + "ay" |
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 translate(word) | |
word_list = word.split(/ /) | |
letters = ('a'..'z').to_a | |
vowels = ['a', 'e', 'i', 'o', 'u'] | |
consonants = letters - vowels | |
result = "" | |
word_list.each do |word| | |
if vowels.include?(word[0]) | |
result << word + "ay" |
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 translate(word) | |
word_list = word.split(/ /) | |
letters = ('a'..'z').to_a | |
vowels = ['a', 'e', 'i', 'o', 'u'] | |
consonants = letters - vowels | |
result = "" | |
word_list.each do |word| | |
if vowels.include?(word[0]) #translate word beginning with vowels. | |
result << word + "ay" |
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
elsif word.index("qu") #word contains 'qu'. | |
if word[0..1].include?("qu") #word begins with 'qu'. | |
result << word[2..-1] + word[0..1] + "ay" | |
else #'qu' is somewhere else in the word. | |
position = word.index("qu") | |
result << word[0..(position - 1)] + "qu" + word[(position + 2)..-1] + "ay" | |
end | |
end |