Skip to content

Instantly share code, notes, and snippets.

View kdefliese's full-sized avatar

Katherine kdefliese

View GitHub Profile
@kdefliese
kdefliese / hcd3.md
Last active February 5, 2016 15:53
HighCharts and D3

HighCharts and D3

Overview

HighCharts and D3 are both data visualization tools that you can add to your website.

Highcharts is an open source Javascript library that provides all kinds of different charts you can use. It is supported by all modern browsers (even IE6+!) and mobile browsers. It does not require client-side plugins like Java or Flash. The HighCharts API allows you to update charts at any time after creation, so they can update as frequently as once per second.

See the demo page here. The demo page includes source code for each of the chart types, which is super useful!

@kdefliese
kdefliese / awesome-print.rb
Created October 1, 2015 00:02
Example to show how to use the awesome-print gem
require "awesome_print"
my_string = "Hello there"
my_array = [1,2,3,4,5,6,"cats",false]
my_hash = {
first_name: "Team",
last_name: "Awesome-Print",
cohort: 4,
student_status: true
}
@kdefliese
kdefliese / planets.rb
Created September 30, 2015 00:04
Solar System wave 2
class Planet
attr_accessor :name, :color, :species, :climate, :num_moons, :industry, :most_famous_inhabitant, :solar_rotation_rate, :distance_from_the_sun
def initialize(planet_hash)
@name = planet_hash[:name]
@color = planet_hash[:color]
@species = planet_hash[:species]
@climate = planet_hash[:climate]
@num_moons = planet_hash[:num_moons]
@kdefliese
kdefliese / planets.rb
Last active September 29, 2015 03:52
Class exercise from 9/28
class Planet
attr_accessor :name, :color, :species, :climate, :num_moons, :industry, :most_famous_inhabitant, :solar_rotation_rate, :distance_from_the_sun
def initialize(name, color, species, climate, num_moons, industry, most_famous_inhabitant, solar_rotation_rate, distance_from_the_sun)
@name = name
@color = color
@species = species
@climate = climate
@num_moons = num_moons
@kdefliese
kdefliese / calculator.rb
Created September 28, 2015 01:33
Calculator exercise from 9/25 class
puts "Hello! We are going to calculate some numbers today. Enter a number:"
num1 = gets.chomp
while num1.to_f.to_s != num1 && num1.to_i.to_s != num1
puts "That's not a number!"
puts "Try again and enter a number:"
num1 = gets.chomp
end
puts "Great! Now enter another number:"
num2 = gets.chomp
@kdefliese
kdefliese / LTP_8-3.rb
Created September 27, 2015 19:40
Homework for 9/25
words = []
word = "string"
while word != ""
puts "Enter a word! Or just hit enter when you are finished entering words!"
word = gets.chomp
words.push(word)
end
puts "#{words.sort}"
@kdefliese
kdefliese / LTP_7-5.rb
Last active September 27, 2015 19:39
Homework for 9/25
# bottles of beer program
num = 99
while num > 0
puts "#{num} bottles of beer on the wall, #{num} bottles of beer!"
num -= 1
puts "Take one down, pass it around, #{num} bottles of beer on the wall!"
end
# grandma program
puts "Say something to grandma:"
@kdefliese
kdefliese / LTP_6-2.rb
Created September 27, 2015 07:03
Homework for 9/25
puts "What do YOU want now?!"
reply = gets.chomp.upcase
puts "WHAT DO YOU MEAN, #{reply}?! YOU'RE FIRED!"
puts "Table of contents".center(40)
puts
puts "Chapter 1: ".ljust(10) + "Getting started" + "page 1".rjust(11)
puts "Chapter 2: ".ljust(10) + "Letters" + "page 10".rjust(20)
puts "Chapter 3: ".ljust(10) + "Numbers" + "page 20".rjust(20)
@kdefliese
kdefliese / LTP_5-6.rb
Created September 25, 2015 01:07
Homework for 9/24
puts "Hello! What's your first name?"
first_name = gets.chomp
puts "What about your middle name? Don't be embarassed!"
middle_name = gets.chomp
puts "And finally, your last name!"
last_name = gets.chomp
puts "So your full name is #{first_name} #{middle_name} #{last_name}? That's a good name!"
puts "What's your favorite number, #{first_name}?"
@kdefliese
kdefliese / random-menu.rb
Created September 24, 2015 22:05
Random menu generator
puts "Hello! This is a random menu generator"
# I added the user-submitted words to my original arrays because it was kind of annoying for the user to have to input 30+ words on the command line...
user_adjectives = ["hot","cold","tasty","spicy","bland","overcooked","raw","disgusting","burned","crispy"]
user_cooking_styles = ["pan-seared","baked","broiled","deep-fried","roasted","julienned","boiled","microwaved","stir-fried","barbecued"]
user_foods = ["yams","bread","peanut butter and jelly sandwiches","yogurts","chia seeds","chocolates","tacos","burritos","gravy","applesauce"]
puts "Let's add some items to the menu!"
3.times { puts "Enter an adjective:"
new_adj = gets.chomp
user_adjectives.push(new_adj) }