Skip to content

Instantly share code, notes, and snippets.

View stevencombs's full-sized avatar

Steven B. Combs' Git stevencombs

View GitHub Profile
<!DOCTYPE html>
<head>
<title>Anna Dowlin</title>
<style>
body {
text-align: center;
background: url("http://dash.ga.co/assets/anna-bg.png");
background-size: cover;
background-position: center;
color: white;
@stevencombs
stevencombs / UnlessControlFlow.rb
Created October 16, 2013 20:34
Unless control flow tests for a false condition
# Ruby Getting Started with Programming
# A Codecademy Ruby (Unless) assignment
# Dr. Steven B. Combs, coding novice
hungry = true
unless hungry # tests for false condition
puts "I'm writing Ruby programs!"
else # if not false, but true
puts "Time to eat!"
@stevencombs
stevencombs / FormInFormatter.rb
Created October 13, 2013 15:50
Input, output and text manipulation in Ruby
# Ruby Getting Started with Programming
# A Codecademy Ruby (Putting the Form in Formatter) assignment
# Dr. Steven B. Combs, coding novice
# gets requests user input and the .chomp modifier excludes new/blank line that ruby includes by default
#request input
print "What's your first name?"
first_name = gets.chomp.capitalize! # Replaces first_name variable with first character capitalized version
print "What's your last name?"
@stevencombs
stevencombs / StockingOut.py
Created October 11, 2013 22:31
Creates a compute_bill function to take the stock/inventory of a particular item into account when computing the cost. If an item isn't in stock, then it is not included in the total.
# Computer the bill for a shopping list
# A Codecademy Python (Stocking Out) assignment
# Dr. Steven B. Combs, coding novice
shopping_list = ["banana", "orange", "apple", "orange", "apple"]
stock = {
"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
// Javascript Getting Started with Programming
// A Codecademy Javascript (Prototype Practice - Objects) assignment
// Dr. Steven B. Combs, coding novice
function Cat(name, breed) {
this.name = name;
this.breed = breed;
}
// Cat Objects
// Javascript Getting Started with Programming
// A Codecademy Javascript (Getting IN-timate) assignment
// Dr. Steven B. Combs, coding novice
var nyc = {
fullName: "New York City",
mayor: "Michael Bloomberg",
population: 8000000,
boroughs: 5
};
// Javascript Getting Started with Programming
// A Codecademy Javascript (I.D. Please and Know Thyself) assignments
// Dr. Steven B. Combs, coding novice
var anObj = { job: "I'm an object!" };
var aNumber = 42;
var aString = "I'm a string!";
// typeof identifies the type from an object, number variable or string variable
console.log(typeof anObj); // will print "object"
// Javascript Getting Started with Programming
// A Codecademy Javascript (Literally Speaking) assignment
// Dr. Steven B. Combs, coding novice
// Object with method (function) using Literal Constrution
var james = {
job: "programmer",
married: false,
speak: function() {
console.log("Hello, I am feeling great");
// Javascript Getting Started with Programming
// A Codecademy Javascript (Fun with Functions) assignment
// Dr. Steven B. Combs, coding novice
// Constructor object notation
function Person(job, married) {
this.job = job;
this.married = married;
this.speak = function () { // Object with function (or method when a part of an object)
console.log ("Hello!");
// Javascript Getting Started with Programming
// A Codecademy Javascript (An Object Review) assignment
// Dr. Steven B. Combs, coding novice
// Create Object Template
function Person(job, married) {
this.job = job;
this.married = married;
}