Skip to content

Instantly share code, notes, and snippets.

View dannyfritz's full-sized avatar
🐦
chirping

Danny Fritz dannyfritz

🐦
chirping
View GitHub Profile
var age_group =
age > 70 ? 'se' :
age > 60 ? 'si' :
age > 50 ? 'fi' :
age > 40 ? 'fo' :
age > 30 ? 'th' :
age > 20 ? 'tw' :
'un';
(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() {};
@dannyfritz
dannyfritz / app.js
Last active August 29, 2015 14:06
My Website!
var $body = $(document.body);
var $welcome = $('<h1>My Website!!!</h1>');
$body.append($welcome);
var $awesome = $('<p>This is so awesome!</p>');
$body.append($awesome);
...
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',
];
{
init: function (elevators, floors)
{
var requestQueue = [];
var request = function (floor, direction)
{
requestQueue.push({
floor: floor,
direction: direction
});
@dannyfritz
dannyfritz / index.js
Created February 11, 2015 04:46
requirebin sketch
var test = require('tape');
test('timing test', function (t) {
t.plan(2);
t.assert(true);
t.assert(false);
});
@dannyfritz
dannyfritz / index.js
Last active August 29, 2015 14:15
requirebin sketch
var nanoscope = require('nanoscope');
var _ = require('lodash');
var game = {
player: {
x: 0
},
board: {
width: 10
}
@dannyfritz
dannyfritz / index.js
Last active August 29, 2015 14:16
requirebin sketch
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);
@dannyfritz
dannyfritz / index.js
Created March 6, 2015 23:01
requirebin sketch
const _fp = require('lodash-fp');
var sum = _fp.reduce(_fp.add, 0);
document.write(sum([1,2,3]));
@dannyfritz
dannyfritz / index.js
Last active June 8, 2021 14:56
requirebin sketch
// 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);