- PNG Example: http://inch-pages.github.io/public/images/badge-example.png
- Current SVG: http://inch-pages.github.io/public/images/badge-example.svg
Badge Height: 16px Grade Height: 8px (padding: 3px)
grade from right: 4px
grade from text: 7px
# Active Record lets you do things like: | |
Post.find(3).title | |
#=> "Hello, world!" | |
# Cool. So my question is, how exactly do you setup a class that allows the | |
# programmer to use there own keyword? My use case: | |
def get(type, id) |
module Get | |
def get() | |
# Code not necessary | |
end | |
end | |
class JTask | |
extend Get | |
end |
require "ostruct" | |
# Actual value obtained from elsewhere, must | |
# be in this format up until now. | |
required_records = {"1" => { "name" => "Adam" }, "2" => { "name" => "John" }} | |
# Loop through each required record and | |
# assemble each key-value into the open structure output. | |
output = Array.new |
# Option 2: Save true or false into the database | |
# This is the model file | |
before_save :verify_use_card | |
def verify_use_card | |
if self.use_credit_card == 1 | |
self.use_credit_card = true | |
else | |
self.use_credit_card = false | |
end |
class Comparison | |
def self.new(string_one, string_two) | |
# Define variables to manipulate later on | |
unchanged, addition = "", "" | |
all_unchanged, all_additions = [], [] | |
# Determine which file has the largest amount of characters | |
if (string_one <=> string_two) < 0 | |
num_chars = string_two.length | |
else |
# Must be defined as a blank array for "<<" to work later on | |
array = Array.new | |
number = 5 | |
number.times do |n| | |
array << n + 1 | |
end | |
puts array |
names = ["beautiful", "stunning", "elegant", "object orientated", "fun", "engaging", "easy", "pragmatic"] | |
names.each do |name| | |
puts "Ruby is #{name}" | |
end | |
#=> Ruby is beautiful | |
#=> Ruby is stunning | |
#=> Ruby is elegant | |
#=> Ruby is object orientated |
Badge Height: 16px Grade Height: 8px (padding: 3px)
grade from right: 4px
grade from text: 7px
prices_hash = { "large" => 12, "medium" => 10, "small" => 8 }
Function calculate_cost(num_rocks, rock_sizes=[])
// Workout base cost
cost = 0
For Each (rock_sizes) as |size|
cost = cost + prices_hash[size]
End Loop
<!-- target aloha editor to edit this div --> | |
<div class="editable_content"> | |
<!-- <?php echo $content_from_database ?> --> | |
<p>Hello, world!</p> | |
</div> | |
<!-- Edit away, and then users click this button to save their changes --> | |
<button class="update_content">Update Content</button> | |
<script src="http://code.jquery.com/jquery-git1.min.js"></script> |