(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.
language: node_js | |
node_js: | |
- "10.4.1" | |
sudo: true | |
addons: | |
chrome: stable | |
branches: | |
only: |
{ | |
"name": "angular-with-ci-cd", | |
"version": "0.0.0", | |
"scripts": { | |
"ng": "ng", | |
"start": "ng serve", | |
"build": "ng build", | |
"test": "ng test", | |
"lint": "ng lint", | |
"e2e": "ng e2e" |
## | |
# Host Database | |
# | |
# localhost is used to configure the loopback interface | |
# when the system is booting. Do not change this entry. | |
## | |
127.0.0.1 localhost | |
255.255.255.255 broadcasthost | |
::1 localhost | |
# Add your domain name here |
let _ = require('lodash'); | |
const finalList = _.chain(oldSelectedList) | |
.unionWith(newlySelectedList, (o, n) => o.id === n.id) | |
.intersectionWith(newlySelectedList, (u, n) => u.id === n.id) | |
.value(); |
let _ = require('lodash'); | |
const unionList = _.unionWith(oldSelectedList, newlySelectedList, (o, n) => o.id === n.id); | |
const finalList = _.intersectionWith(unionList, newlySelectedList, (u, n) => u.id === n.id); |
const oldSelectedList = [ | |
{id: 1, name: 'apple', serverAttribute1: 'some value', serverAttribute2: 'some value'}, | |
{id: 2, name: 'orange', serverAttribute1: 'some value', serverAttribute2: 'some value'} | |
]; | |
const newlySelectedList = [ | |
{id: 3, name: 'grape'}, | |
{id: 2, name: 'orange'} | |
]; |
(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.
import com.fasterxml.jackson.databind.ObjectMapper | |
import com.github.kittinunf.fuel.httpGet | |
import com.github.kittinunf.fuel.httpPost | |
import tech.ajira.kitCoin.models.Block | |
object BlockService { | |
fun broadcastNewBlock(nodeAddresses: Set<String>, newBlock: Block) { | |
val jsonString = ObjectMapper().writeValueAsString(newBlock) | |
nodeAddresses.forEach { nodeAddress -> |
Class Hasher { | |
fun hash(): String { | |
val bytes = this.toString().toByteArray() | |
val md = MessageDigest.getInstance("SHA-256") | |
val digest = md.digest(bytes) | |
return digest.fold("", { str, it -> str + "%02x".format(it) }) | |
} | |
} |