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 age_group = | |
age > 70 ? 'se' : | |
age > 60 ? 'si' : | |
age > 50 ? 'fi' : | |
age > 40 ? 'fo' : | |
age > 30 ? 'th' : | |
age > 20 ? 'tw' : | |
'un'; |
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 (root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
define(['lodash'], factory); | |
} else { | |
root.amdWeb = factory(root._); | |
} | |
}(this, function (b) { | |
var Fond = function(options) { | |
this.update = function() {}; | |
this.draw = function() {}; |
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 $body = $(document.body); | |
var $welcome = $('<h1>My Website!!!</h1>'); | |
$body.append($welcome); | |
var $awesome = $('<p>This is so awesome!</p>'); | |
$body.append($awesome); |
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 legacyScriptsArr = [ | |
'./path/to/legacy-script1.js', | |
'./path/to/legacy-script2.js', | |
'./path/to/legacy-script3.js', | |
'./path/to/legacy-script4.js', | |
'./path/to/legacy-script5.js', | |
]; |
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
{ | |
init: function (elevators, floors) | |
{ | |
var requestQueue = []; | |
var request = function (floor, direction) | |
{ | |
requestQueue.push({ | |
floor: floor, | |
direction: direction | |
}); |
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 test = require('tape'); | |
test('timing test', function (t) { | |
t.plan(2); | |
t.assert(true); | |
t.assert(false); | |
}); |
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 nanoscope = require('nanoscope'); | |
var _ = require('lodash'); | |
var game = { | |
player: { | |
x: 0 | |
}, | |
board: { | |
width: 10 | |
} |
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
const R = require('ramda'); | |
const _ = require('lodash'); | |
var answer = _(_.range(1,10)).reduce(R.multiply, 1); | |
console.log(answer); | |
answer = R.product(R.range(1,10)); | |
console.log(answer); |
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
const _fp = require('lodash-fp'); | |
var sum = _fp.reduce(_fp.add, 0); | |
document.write(sum([1,2,3])); |
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
// require() some stuff from npm (like you were using browserify) | |
// and then hit Run Code to run it on the right | |
var d3 = require('d3') | |
var cloud = require('d3-cloud'); | |
var _ = require('lodash'); | |
var stripCommonWords = require('strip-common-words'); | |
var input = 'We’re happy to announce the release of React 0.14 today! This release has a few major changes, primarily designed to simplify the code you write every day and to better support environments like React Native. React React React!'; | |
console.log(input); |
OlderNewer