Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added dylan_eckert/express/counter.zip
Binary file not shown.
Binary file added dylan_eckert/express/surveyform.zip
Binary file not shown.
19 changes: 19 additions & 0 deletions dylan_eckert/javascript/advanced/fibnacci.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function fib() {
var prev = 0;
var current = 1;
function nacci() {
// do something to those variables here
newCur = prev + current;
prev = current;
console.log(current);
current = newCur;
}
return nacci
}
var fibCounter = fib();
fibCounter() // should console.log "1"
fibCounter() // should console.log "1"
fibCounter() // should console.log "2"
fibCounter() // should console.log "3"
fibCounter() // should console.log "5"
fibCounter() // should console.log "8"
25 changes: 25 additions & 0 deletions dylan_eckert/javascript/advanced/huntinggithub.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>hunting github</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<button id="button">Find my name!</button>
<script type="text/javascript">
var button = document.getElementById('button');
var getData = function(){
$.get("https://api.github.com/users/dylan-eckert", displayName);
}
button.addEventListener("click", getData);

function displayName(data) {
let name = document.createElement("p");
name.innerHTML = data['name'];
document.body.appendChild(name);
}
</script>
</body>
</html>
105 changes: 105 additions & 0 deletions dylan_eckert/javascript/advanced/jslibrary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
var _ = {
map: function(arr, callback, modifier) {
var newArr = [];
for (var i = 0; i < arr.length; i++) {
newArr.push(callback(arr[i], modifier));
}
return newArr;
},
reduce: function(arr, callback, startVal) {
if (startVal) {
var idx = 0;
var total = startVal;
} else {
var idx = 1;
var total = arr[0];
}
for (var i = idx; i < arr.length; i++) {
var newTotal = callback(arr[i], total);
total = newTotal;}
return total;
},
find: function(arr, callback, findthis) {
var newArr = [];
for (var i = 0; i < arr.length; i++) {
if (callback(arr[i], findthis)) {
newArr.push(arr[i]);
}else{
continue;
}
}
if (newArr[0]) {
return "Found "+newArr+"!";
} else {
return "Couldn't find your selected thing!";
}
},
filter: function(arr, callback) {
var newArr = [];
for (var i = 0; i < arr.length; i++) {
if (callback(arr[i])) {
newArr.push(arr[i]);
}
}
return newArr
},
reject: function(arr, callback) {
var newArr = [];
for (var i = 0; i < arr.length; i++) {
if (!callback(arr[i])) {
newArr.push(arr[i]);
}
}
return newArr
}
}
// These are the functions needed for the _ methods:
// filter method function:
function isEven(num) {
return num % 2 == 0;
};
// map method function:
function transform(num, modifier) {
return num * modifier;
};
// reduce method function:
function combine(num, total) {
return num + total;
};
// find method function:
function finding(val, compare) {
return val == compare;
};
// reject method function:
function isOdd(num) {
return num % 2 == 0;
};

// you just created a library with 5 methods!
// FILTER
var evens = _.filter([1, 2, 3, 4, 5, 6], isEven);
console.log(evens); // if things are working right, this will return [2,4,6].
// MAP
var map2 = _.map([1, 2, 3, 4], transform, 2);
console.log(map2) // if things are working right, this will return [2,4,6,8].
var map3 = _.map([1, 2, 3, 4], transform, 3);
console.log(map3) // if things are working right, this will return [3,6,9,12].
var map15 = _.map([1, 2, 3, 4], transform, 15);
console.log(map15) // if things are working right, this will return [15,30,45,60].
// REDUCE
var startValNull = _.reduce([1, 2, 3, 4, 5], combine); // should return 15
console.log(startValNull);
var startValZero = _.reduce([1, 2, 3, 4, 5], combine, 0); // should return 15
console.log(startValZero);
var startValTwo = _.reduce([1, 2, 3, 4, 5], combine, 2); // should return 17
console.log(startValTwo);
// FIND
var find5 = _.find([3,4,5,1,6,7], finding, 5) // should return Found 1!
console.log(find5)
var findstring1 = _.find(['hello', 'world'], finding, 'world')
console.log(findstring1);
var find2 = _.find([3,4,5,1,6,7], finding, 2) // should return Couldn't find your selected thing!
console.log(find2)
// REJECT
var odds = _.reject([1, 2, 3, 4, 5, 6], isOdd);
console.log(odds); // if things are working right, this will return [2,4,6].
Original file line number Diff line number Diff line change
@@ -1,52 +1,45 @@
<html>
<head>
<title>Javascript Demo</title>
<style>
body {
background-color:black;
font-family: monospace;
color:white;
font-size:50px;
text-align: center;
margin-top:20%;
}
#magic{
color: #777;
border-right: 1px solid #777;
padding-right: 7px;
display: inline;
}
</style>
</head>
<body>

Coding is <div id="magic"></div>

<script>
var words = ["a lot of fun", "about not giving up", "challenging and empowering", "creative expression", "what I learned at CodingDojo!"],
el = document.getElementById('magic'),
word_counter = 0,
character_counter = 0;
function updateText()
{
if(words[word_counter][character_counter] == " "){
el.innerHTML = el.innerHTML + "&nbsp;";
character_counter++;
}
else{
el.innerHTML = el.innerHTML+words[word_counter][character_counter++];
}
if(character_counter == words[word_counter].length+1)
{
word_counter++; //choose a different word
character_counter = 0; //start over with the first character of the word
el.innerHTML = ''; //set the html to be blank
//if we're displaying the last word, go back to the first word
if(word_counter == words.length)
word_counter = 0;
}
}
setInterval(updateText,400);
</script>
</body>
</html>
<html>
<head>
<title>Javascript Demo</title>
<style>
body {
background-color:black;
font-family: monospace;
color:white;
font-size:50px;
text-align: center;
margin-top:20%;
}
#magic{
color: #777;
border-right: 1px solid #777;
padding-right: 7px;
display: inline;
}
</style>
</head>
<body>
Coding is <div id="magic"></div>

<script>
var words = ["a\u00A0lot\u00A0of\u00A0fun", "about\u00A0not\u00A0giving\u00A0up", "challenging\u00A0and\u00A0empowering", "creative\u00A0expression", "what\u00A0I\u00A0learned\u00A0at\u00A0CodingDojo!"],
el = document.getElementById('magic'),
word_counter = 0,
character_counter = 0;
function updateText()
{
el.innerHTML = el.innerHTML+words[word_counter][character_counter++];
if(character_counter == words[word_counter].length+1)
{
word_counter++; //choose a different word
character_counter = 0; //start over with the first character of the word
el.innerHTML = ' '; //set the html to be blank
//if we're displaying the last word, go back to the first word
if(word_counter == words.length)
word_counter = 0;
}
}
setInterval(updateText,300);
</script>
</body>
</html>
47 changes: 47 additions & 0 deletions dylan_eckert/javascript/js_fund/jsbasics1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script type="text/javascript">
// ----Basic 1----
// var x = [];
// console.log(x);
// x.push('coding', 'dojo', 'rocks');
// x.pop('rocks');
// console.log(x);
// ----Basic 2----
// const y = [];
// console.log(y);
// y.push(88)
// console.log(y);
// This is allowed because constant prevents the change of DATA TYPE, but it allows the change of the value if it matches original DATA TYPE
// ----Basic 3----
// var z = [9, 10, 6, 5, -1, 20, 13, 2]
// for (i = 0; i < z.length; i++){
// console.log(z[i]);
// }
// for every number but last number
// for (i = 0; i < z.length-1; i++){
// console.log(z[i]);
// }
// ----Basic 4----
// var names = ['Kadie', 'Joe', 'Fritz', 'Pierre', 'Alphonso']
// for (i = 0; i < names.length; i++){
// console.log(names[i].length)
// }
// for (i = 0; i < names.length; i++){
// if (names[i].length > 5) {
// console.log(names[i].length)
// }
// }
// ----Basic 5----
// function yell(string){
// return string.toUpperCase();
// }
// console.log(yell('hello world!'));
</script>
</body>
</html>
43 changes: 43 additions & 0 deletions dylan_eckert/javascript/js_fund/jsbasics2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script type="text/javascript">
function magic_multiply(x, y){
if(x.constructor === Array){
for(var i = 0; i < x.length; i++){
x[i]=(x[i]*y)
}
} else if(x.constructor === Number && y.constructor === Number){
if(x == 0 && y == 0) {
return "all inputs 0"
}else{
x = x * y;
}
} else if(y.constructor === String){
return "cannot multiply by string"
} else if(x.constructor === String){
string = ""
for (var i = 0; i < y; i++) {
string += x
}
return string
}
return x;
}
let test1 = magic_multiply(5, 2);
console.log(test1);
let test2 = magic_multiply(0, 0);
console.log(test2);
let test3 = magic_multiply([1, 2, 3], 2);
console.log(test3);
let test4 = magic_multiply(7, "three");
console.log(test4);
let test5 = magic_multiply("Brendo", 4);
console.log(test5);
</script>
</body>
</html>
20 changes: 20 additions & 0 deletions dylan_eckert/javascript/js_fund/jsdom1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<html>
<body>
<h1>Students</h1>
<ul id="main">
<!-- this is empty-->
</ul>
<script>
function appendList(array, id){
for (var i = 0; i < array.length; i++) {
let name = document.createElement("li");
name.innerHTML = array[i];
document.getElementById(id).appendChild(name);
};
};
let students = ["Jeff", "Jenny", "Javier", "Joslyn", "Joe", "Jane", "Django"];
let target_id = "main";
appendList(students, target_id);
</script>
</body>
</html>
Loading