This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// these are the same | |
// as a function | |
var square = function (a){ | |
return a * a; | |
} | |
// as a lamda function | |
var square = (a) => { | |
return a * a; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Animal(name, numLegs) { | |
this.name = name; | |
this.numLegs = numLegs; | |
}; | |
Animal.prototype.sayName = function() { | |
console.log('Hi my name is ' + this.name); | |
}; | |
var penguin = new Animal("Captain Cook", 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function list() { | |
contacts.map(printPerson); | |
}; | |
list(); | |
Inside of the loop, add code to call printPerson, passing in the element of the array that the loop is currently at. | |
At the very bottom of the file, call the list function. The list function should then loop through every member of the contacts array and print its information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Delay a JS Promise by a number | |
// of miliseconds. Preserves arguments. | |
const delayPromise = (duration) => { | |
return (...args) => { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve(...args); | |
}, duration); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* get - XHR Request | |
*/ | |
let get = function (url) { | |
return function (callback) { | |
let xhr = new XMLHttpRequest(); | |
xhr.open('GET', url); | |
xhr.onreadystatechange = function() { | |
let response = xhr.responseText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Canvas Test</title> | |
</head> | |
<body> | |
<canvas id='myGame'></canvas> | |
<script src='main.js'></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XSS Example | |
=========== | |
Okay so an example of one way that websites can be insecure is XSS. | |
By all means read more on wiki. | |
XSS == Cross Site Scripting | |
It works like this.... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Examples of loops in diffrent languages | |
Each example prints the numbers 0 --> 9 inclusive. | |
// Javascript | |
for (var i = 0; i < 10; i += 1){ | |
console.log(i); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
service mongod stop | |
echo > /etc/yum.repos.d/mongodb-org-2.6.repo | |
echo "[mongodb-org-2.6]" >> /etc/yum.repos.d/mongodb-org-2.6.repo | |
echo "name=MongoDB 2.6 Repository" >> /etc/yum.repos.d/mongodb-org-2.6.repo | |
echo "baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/" >> /etc/yum.repos.d/mongodb-org-2.6.repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:0.10 | |
RUN mkdir -p /usr/src/app | |
WORKDIR /usr/src/app | |
COPY package.json /usr/src/app/ | |
RUN npm install | |
COPY . /usr/src/app |