This file contains hidden or 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
{ | |
"Seti_sb_tree_miny": true, | |
"Seti_tabs_med": true, | |
"auto_complete": true, | |
"auto_complete_commit_on_tab": true, | |
"auto_complete_delay": 50, | |
"auto_complete_selector": "source - comment", | |
"auto_complete_size_limit": 4194304, | |
"auto_complete_triggers": | |
[ |
This file contains hidden or 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
gulp.task('jekyll', function(){ | |
return require('child_process').spawn('jekyll', ['serve', '--watch'], { stdio: 'inherit' }); | |
}); | |
gulp.task('default', ['jekyll']); |
This file contains hidden or 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
<div class="tooltip"> | |
<span class="tooltip__icon"></span> | |
<h2 class="tooltip__heading">This is the heading</h2> | |
<p class="tooltip__text">This is some body text that can get kinda long sometimes.</p> | |
<div class="tooltip__meta">Created today</div> | |
</div> | |
<br><br> | |
<div class="tooltip--below"> |
This file contains hidden or 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
// 1. Write a class to support the following code: | |
function Person(name){ | |
this.name = name; | |
} | |
var thomas = new Person('Thomas'); | |
var amy = new Person('Amy'); | |
thomas.name // --> "Thomas" | |
// 2. Add a getName() method to all Person objects, that outputs |
This file contains hidden or 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
// A tracing version: | |
Function.prototype.cached = function(){ | |
var self = this, cache = {}; | |
return function(arg){ | |
if(arg in cache) { | |
console.log('Cache hit for '+arg); | |
return cache[arg]; | |
} else { | |
console.log('Cache miss for '+arg); |
This file contains hidden or 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.prototype.cached = function(){ | |
// reference original function and create cache | |
var self = this, cache = {}; | |
return function(arg){ | |
// is this argument already in the cache? | |
if(arg in cache) return cache[arg]; | |
// if not add it | |
return cache[arg] = self(arg); | |
} | |
} |
This file contains hidden or 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 Car(color,make) { | |
this.color = color; | |
this.make = make; | |
this.log = function(){ | |
console.log("My car is a " + this.color + " " + this.make + "."); | |
}; | |
} | |
(new Car('blue','BMW')).log(); | |
(new Car('green','Ferrari')).log(); |
This file contains hidden or 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
var mercedes = ({ color: 'red', make: 'Mercedes' }); | |
var ferrari = ({ color: 'red', make: 'Ferrari' }); | |
function logCar(car){ | |
return "I'm a " + car.color + " " + car.make; | |
} | |
logCar(mercedes); | |
logCar(ferrari); |
This file contains hidden or 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 logCar(obj, objName) { | |
var result = ""; | |
// Object.keys(obj).length | |
for (var i in obj) { | |
if (obj.hasOwnProperty(i)) { | |
result += obj[i] + " "; | |
} | |
} | |
console.log("My car is a " + result); | |
} |
This file contains hidden or 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
// Exercise 2 - Closures | |
// Wrap the following code in a closure and export only the "countdown" function. | |
// Code | |
var countdown = (function(){ | |
var index; | |
function log(){ | |
console.log(index); | |
} |
NewerOlder