Skip to content

Instantly share code, notes, and snippets.

View stevencombs's full-sized avatar

Steven B. Combs' Git stevencombs

View GitHub Profile
@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;
}
// Javascript Getting Started with Programming
// A Codecademy Javascript (Findng the Special Someone) assignment
// Dr. Steven B. Combs, coding novice
var bob = {
firstName: "Bob",
lastName: "Jones",
phoneNumber: "(650) 777-7777",
email: "bob.jones@example.com"
};
@stevencombs
stevencombs / ListingEveryone.js
Created September 25, 2013 21:22
See DisplayingPeople.js for additional details. https://gist.github.com/stevencombs/6706133
// Javascript Getting Started with Programming
// A Codecademy Javascript (ListingEveryone) assignment
// Dr. Steven B. Combs, coding novice
var bob = {
firstName: "Bob",
lastName: "Jones",
phoneNumber: "(650) 777-7777",
email: "bob.jones@example.com"
};