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
//---------------------------------- | |
// Prototype Demo | |
// --------------------------------- | |
// Define functional object constructor called Quadrilateral | |
// with width and height as parameters. | |
var Quadrilateral = function(width, height) { | |
this.width = width; | |
this.height = height; |
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
// | |
// Simple demonstration Call and Apply methods | |
// | |
// Square object with a color property and 2 methods | |
var square = { | |
color: "red", | |
getColor: function () { | |
return "I am the color " + this.color + "!"; |
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
// Some helper Sass mixins | |
@mixin clear() { | |
&:before, &:after { | |
content: ""; | |
display: block; | |
width: 100%; | |
height: 0; | |
overflow: hidden; | |
} |
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
<!-- Audio Control Buttons --> | |
<button id="play-button">Play</button> | |
<button id="stop-button">Stop</button> | |
<button id="pause-button">Pause</button> | |
<button id="loop-button">Loop</button> |
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
<!-- Video element (live stream) --> | |
<label>Video Stream</label> | |
<video autoplay id="video" width="640" height="480"></video> | |
<!-- Canvas element (screenshot) --> | |
<label>Screenshot (base 64 dataURL)</label> | |
<canvas id="canvas" width="640" height="480"></canvas> | |
<!-- Capture button --> | |
<button id="capture-btn">Capture!</button> |
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
'use strict'; | |
module.exports = function (grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
express: { | |
all: { | |
options: { | |
port: 9000, | |
hostname: 'localhost', |
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
# The upstream module is the link between Node.js and Nginx. | |
# Upstream is used for proxying requests to other servers. | |
# All requests for / get distributed between any of the servers listed. | |
upstream helloworld { | |
# Set up multiple Node.js webservers for load balancing. | |
# max_fails refers to number of failed attempts | |
# before server is considered inactive. | |
# weight priorities traffic to server. Ex. weight=2 will recieve | |
# twice as much traffic as server with weight=1 | |
server <your server ip>:3000 max_fails=0 fail_timeout=10s weight=1; |
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
// Memoization technique. | |
// Try it. Open up the console on your browser and run: | |
// isPrime(5); // returns a boolean | |
// or someFunc('foo', 10); // returns an object | |
// The first time it will do the calculation and store the result, | |
// so next time you run isPrime(5) it will retrieve the result from | |
// the function's cache. The result is also stored in local storage | |
// so that it doesn't have to recalculate if you refresh the page. | |
// It'll retrieve the stored result from local storage. |
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
# Fires up a web server on localhost:8000 | |
# | |
# Example: | |
# | |
# ~/workspace $ server | |
# Serving HTTP on 0.0.0.0 port 8000 ... | |
function server() { | |
local port="${1:-8000}" | |
open "http://localhost:${port}/" |