const compose = (...fns) =>
fns.reduceRight((prevFn, nextFn) =>
(...args) => nextFn(prevFn(...args)),
value => value
);
This file contains hidden or 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 isWalkable = value => value !== null && typeof value !== 'undefined'; | |
| const getChild = (parent, child) => (isWalkable(parent) ? parent[child] : undefined); | |
| const getIn = (descendants, origin) => descendants.split('.').reduce(getChild, origin); |
This file contains hidden or 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
| /* | |
| yarn init -y | |
| yarn add webpack webpack-cli webpack-serve html-webpack-plugin -D | |
| yarn add babel-loader@^8.0.0-beta @babel/core @babel/preset-env -D | |
| echo '{ "presets": ["@babel/preset-env"] }' > .babelrc | |
| */ | |
| const HtmlPlugin = require("html-webpack-plugin"); | |
| module.exports = { | |
| mode: process.env.NODE_ENV || "development", |
This file contains hidden or 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
| fn main() { | |
| let rng = 0..30; | |
| let rng_even_cubed = rng.filter(|n| is_even(*n)) | |
| .map(|n| n * n * n) | |
| .collect::<Vec<i32>>(); | |
| println!("{:?}", rng_even_cubed); | |
| } | |
| fn is_even(n: i32) -> bool { | |
| n % 2 == 0 |
docker pull gcr.io/google_containers/kube-apiserver-amd64:v1.5.0
docker pull gcr.io/google_containers/kube-controller-manager-amd64:v1.5.0
docker pull gcr.io/google_containers/kube-proxy-amd64:v1.5.0
docker pull gcr.io/google_containers/kube-scheduler-amd64:v1.5.0
docker pull weaveworks/weave-npc:1.8.2
docker pull weaveworks/weave-kube:1.8.2
This file contains hidden or 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
| /** | |
| * Utility function to create DOM element with populated attributes and content | |
| * | |
| * Usage : | |
| * | |
| * // simple element | |
| * let input = createDomElement("input", { | |
| * type: "search", | |
| * placeholder: "Enter what pleases you" | |
| * }); |
This file contains hidden or 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
| import m from 'mithril' | |
| export default ( ...input ) => { | |
| const parent = m( ...input ) | |
| return ( | |
| parent.children == undefined | |
| ? parent | |
| : Object.assign( parent, { | |
| children : children.map( child => Object.assign( child, { parent } ) ) |
This file contains hidden or 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
| package main | |
| import ( | |
| "context" | |
| "flag" | |
| "fmt" | |
| "io" | |
| "net" | |
| "net/http" | |
| "os" |
This file contains hidden or 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
| // gcc -Wall -o BluetoothRSSI BluetoothRSSI.m -framework Foundation -framework IOBluetooth ; ./BluetoothRSSI | |
| #import <Foundation/Foundation.h> | |
| #import <IOBluetooth/IOBluetooth.h> | |
| int width = 32; // display width in characters | |
| int refresh = 33; // refresh rate milliseconds | |
| int main(int argc, const char * argv[]) { | |
| @autoreleasepool { |
This file contains hidden or 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 uuid () { | |
| function getRandomSymbol (symbol) { | |
| var array; | |
| if (symbol === 'y') { | |
| array = ['8', '9', 'a', 'b']; | |
| return array[Math.floor(Math.random() * array.length)]; | |
| } | |
| array = new Uint8Array(1); |