Skip to content

Instantly share code, notes, and snippets.

View tpowell's full-sized avatar

Thomas A Powell tpowell

View GitHub Profile
@tpowell
tpowell / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Vanilla JS DOM Fun</title>
<style>
#p1 {background-color: orange}
.done {font-style: italic;}
</style>
</head>
@tpowell
tpowell / isodd.html
Created October 29, 2014 04:23
isOdd function from JS1 lecture
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Odd Check!</title>
<style>
.errMsg {color: red; font-style: italic;}
output {background-color: orange;
width: 40%; text-align: center;
/**
* function funname - does something cool
*/
JS.funname = function() {
// Debug-start
if (JS.DEBUG) { console.log("Entering funname function"); }
// Debug-end
@tpowell
tpowell / hellojsworld.html
Created June 25, 2013 23:22
Simple helloworld example. Yes document.write is here but calm yourself if you know JS as we are on boarding people. Sadly alert is no better and console.log() is a next step with certain assumptions.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Hello World</title>
</head>
<body>
<h1>First HTML Based JavaScript</h1>
<hr>
<script>
function doAlert(s) {
alert("I am doing an alert and it says " + s);
}
@tpowell
tpowell / gist:3977713
Created October 30, 2012 01:09
Quiz 2 - Ex 4
for (var aProp in window.navigator) {
document.write("window.navigator." + aProp + " = " + window.navigator[aProp] + "<br>");
}
@tpowell
tpowell / gist:3977710
Created October 30, 2012 01:07
Quiz 2 - Ex 3
var stooge = "Moe";
switch (stooge) {
case "Moe" : document.write("Why I outta...");
break;
case "Larry" : document.write("Hey Moe");
break;
@tpowell
tpowell / gist:3977706
Created October 30, 2012 01:06
Quiz 2 - Ex 2
for (var i = 0 ; i <= 25; i+= 5) {
document.write("i = " + i + "<br>");
}
@tpowell
tpowell / gist:3977703
Created October 30, 2012 01:04
Quiz 2 - Ex 1
var myName, myAge, likeDogs;
myName = "Joe P. Somolovich";
myAge = 31;
likeDogs = true;
document.write("Hi my name is " + myName);
document.write(" and I am " + myAge + " years old.");
if (likeDogs)