(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |
"use strict"; | |
var gulp = require('gulp'); | |
var connect = require('gulp-connect'); // Runs a local dev server | |
var open = require('gulp-open'); | |
var browserify = require('browserify'); | |
var source = require('vinyl-source-stream'); | |
var concat = require('gulp-concat'); | |
var eslint = require('gulp-eslint'); | |
var babelify = require('babelify'); |
getDate: function(driverDobParam) { | |
const givenDate = driverDobParam || this.state.formDob || this.props.dob; | |
const timestamp = Date.parse(givenDate); | |
let dateGiven; | |
if (!isNaN(timestamp)) { | |
dateGiven = new Date(timestamp); | |
} | |
return dateGiven; | |
}, | |
validatedDate: function(givenDate) { |
#Comprehensive Introduction to @ngrx/store By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
The power of a Static Typed language can seem magical at first. But the goal here is to take a tiny peak behind that curtain.
Elm's implementation of JSON parsing is type safe and how it achieves that can seem like a mystery. Even though I got the code to work, it took me a while to fully understand how it works.
I'm writing it down here for 2 reasons. To help others gain a greater understanding of Types and so I don't forget what I learned.
recurse :: (Integral a) -> a -> a | |
recurse 1 = 1 | |
recurse 0 = 1 | |
recurse n = recurse (n-2) + recurse (n-1) | |
-- refactoring | |
recurse :: (Integral a) -> a -> a | |
recurse n | |
| n < 2 = 1 | |
| otherwise = recurse (n-2) + recurse (n-1) |
function Index() { | |
this.importedJson = {} | |
} | |
Index.prototype.createIndex = function () { | |
fetch('the url to the jsoin').then((res)=> { | |
return res.json() | |
}).then((res)=> { | |
this.importedJson = res | |
}) |
function pay() { | |
for(var i = 0; i< employees.length; i++ ){ | |
if(employees[i].isPayDay()){ | |
let pay = employees[i].calculate(pay); | |
employees[i].deliverPay(pay); | |
} | |
} | |
} | |
// This particular piece of code does three things.. Refactoring |
function promiseFn(id) { | |
// replace this with your axios function, this is an asyn simulator | |
return new Promise(function(resolve, reject){ | |
setTimeout(()=> resolve(id), 2000); | |
}); | |
} | |
let makePromises = (result) => result.map(promiseFn); | |
Promise.all(makePromises([1,2,3,4,5])).then(function(r){ | |
console.log(r) |