Skip to content

Instantly share code, notes, and snippets.

View mh108's full-sized avatar

Michael Hennessy mh108

View GitHub Profile
//Object Literals
//Example 1 -----------------------------------
let superman = {
name: "Superman",
"real name": "Clark Kent",
height: 75,
weight: 235,
hero: true,
//JavaScript Database Example: JSON
let student1 = {
"fname": "Jille",
"lname": "Bonnefemme",
"UOID": 951270007,
"classrank": "sophomore",
"courses": ["110", "111"],
"website": "https://www.uoregon.edu/~jilleb/"
};
<!DOCTYPE html>
<html>
<head>
<title>Creating Elements</title>
<style>
body {
background-color: #0E454C; /* color names also work */
padding: 30px;
}
//return [1 ..6]
let rollDie = () => {
return Math.floor(Math.random() * 6) + 1;
};
//use a while loop
function rollUntil_v1(target) {
let count = 0;
//priming roll, before the loop
//return 0 (tails) or 1 (heads)
let flipCoin = function() {
return Math.floor( (Math.random() * 2) );
};
// return random integer 1 .. max
function getRandomInt(max) {
return Math.floor(Math.random() * max) + 1;
}
//From our textbook website
//https://www.kirupa.com/html5/the_devowelizer.htm
function isVowel(char) {
return char == 'a' ||
char == 'e' ||
char == 'i' ||
char == 'o' ||
char == 'u' ||
//Example: 1st Ten Laws of Advertising
//first ten laws of advertising
const NUM_OF_LAWS = 10;
let result = "";
//count from 1..10
for (let i = 1; i <= NUM_OF_LAWS; ++i) {
result = result + "Repetition\n";
const SPEED_LIMIT = 55; //global symbolic constant
function amISpeeding(speed) {
if (speed > SPEED_LIMIT) {
alert("Yes. You are speeding-- $$$ ticket.");
} else {
alert("No. You are not speeding.");
}
}
//jshint esversion: 6
let controller = function() {
$.ajax({
url: "http://localhost:8888/todos",
method: "GET"
}).done((res) => {
let pElem;
//console.log(res.comments[0]._id + " " + res.comments[0].data)
<h2>CIT Code Portfolio for M. O'Shaunessy</h2>
The University of Oregon's Computer Science Department offers a Computer Information Technology minor.
The CIT minor prepares students to use and apply technologies in workplace environments that require development and management of databases, computer networks, web applications, and software systems.
<h2>CIT Class Projects</h2>
The CIT minor consists of six classes:
<ol>