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
var countdown = (function() { | |
var index; | |
function log(){ | |
console.log(index); | |
} | |
function iterate(){ | |
log(); | |
if(index>1) setTimeout(iterate, 1000); |
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
// Implement a number Prototype function for repeating strings. | |
// (4).times('test') --> 'testtesttesttest' | |
// Example in functional programming: | |
function repeatString(string, times){ | |
var result = ''; | |
while(times--) result += string; | |
return result; | |
} |
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
// Exercise 1 - OO || !OO | |
// Define a data structure for cars (make and color), and a function | |
// that logs a string like "I'm a red Mercedes" to the console. | |
// Make two versions: a functional version, and a object-oriented version. | |
function logCar(params) { | |
if(params && params.color && params.make) { | |
console.log("I'm a " + params.color + " " + params.make ); | |
} | |
} |
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
<div id="the_div"> | |
<ul id="the_list"> | |
<li id="the_item">Click me!</li> | |
</ul> | |
</div> | |
<p id="log"></p> | |
<script type="text/javascript" charset="utf-8"> | |
function log(string){ |
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
public class DataController : Controller | |
{ | |
public ActionResult Submit(string status) | |
{ | |
var resultObject = new SomeViewModel(); | |
_eastClass.PutStatus(status, fillResultObjectAction(resultObject); | |
return View(resultObject); |
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
<div class="wrap"> | |
<div class="header"><span>Todo List</span></div> | |
<div class="wrap-list"> | |
<ol class="list"> | |
<li> | |
<input type="checkbox" id="check-1" checked="checked"> | |
<label for="check-1">Shop</label> | |
</li> | |
<li> | |
<input type="checkbox" id="check-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
var lookupExecute = function( products, processCommands) { | |
this.commandArray = processCommands; | |
this.lookupArray = products; | |
}; | |
// unwrapped values in functor, apply given function over each command object that has lookup items that meet the condition | |
lookupExecute.prototype.fmap = function(fn) { | |
var self = this, | |
mappedResults = map(this.commandArray, function(command) { | |
var matchedItems = self.lookupArray.filter(function(item) { |
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
augmentProduct = function (findEmployee, carrierName, product) { | |
var view = this, | |
augmentedProduct = _.clone(product); | |
var augEmpRates = _.map(augmentedProduct.employeeRates, function (currRate) { | |
var augEmpRate = _.extend(currRate, { employee: {} }); | |
return augEmpRate; | |
} | |
augmentedProduct.employeeRates = augEmpRates; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/bacon.js/0.7.83/Bacon.min.js"></script> | |
<style id="jsbin-css"> | |
body { | |
font-size: 200px; |
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
((global,Bacon)=> { | |
const pollingInterval = 1000; | |
const getCurrentDateAndTime = ()=> new Bacon.Next(new Date()); | |
const getTime = (currentDate)=> ({ | |
hour: currentDate.getHours ( ), | |
minutes: currentMinutes = currentDate.getMinutes ( ), | |
seconds: currentDate.getSeconds ( ) | |
}); | |
const convertMinutesAndSeconds = (currentTime)=> ({ | |
hour : currentTime.hour, |
OlderNewer