I hereby claim:
- I am thomhos on github.
- I am thomhos (https://keybase.io/thomhos) on keybase.
- I have a public key ASDHiaz_KA0Cb26Jrs9PRwkvpfN_dMyoJSUT_rCRzNna6Qo
To claim this, I am signing this object:
// You can create a ConfigurableValue which is either 'private' or 'public'. | |
// When creating the configuration, you pass in the context. Based on that some values are undefined or not. | |
// Typescript will tell you which ones are available and which ones aren't. | |
import R from "ramda"; | |
export type Country = string; | |
export type Language = string; | |
export type Environment = "production" | "staging" | "branch" | "development"; |
I hereby claim:
To claim this, I am signing this object:
const testArray = [1,2,4,5,3,9,7,8,5,4,9,39,203,495,404,93,39] | |
const target = 93 | |
const bubbleSort = (inArr) => { | |
const arr = [...inArr] | |
for(let i = 0; i < arr.length ; i++) { | |
for(let j = 0; j < arr.length ; j++) { | |
if(arr[j] > arr[j + 1]) { | |
const t = arr[j] |
/* | |
* Each property has getters and setters with subscribers | |
*/ | |
let subscribers = new Set() | |
let activeJob = null | |
let a = 3 | |
const state = { | |
get a () { |
/* | |
* State change mechanism | |
*/ | |
let update | |
const onStateChange = _update => { | |
update = _update | |
} | |
const setState = newState => { |
// Require libs | |
var Rx = require('rxjs/Rx'); | |
var yo = require('yo-yo'); | |
// Select dom elements | |
var inputField = document.querySelector('.input'); | |
var suggestionsEl = document.querySelector('.suggestions'); | |
// Create streams | |
var response$ = new Rx.BehaviorSubject({ query: '', results: []}); |
// Basics | |
fn = ({name, color}) => console.log(name, color); // logs: foo bar | |
fn = ([name, color]) => console.log(name, color); // logs: foo bar -- in case it comes from an array (by index) | |
// Renaming | |
fn = ({ first: firstName }) => console.log(firstName); // logs: foo | |
const $buttons = document.querySelectorAll('button'); | |
// Create array from an array-like object | |
const buttonLabels = Array.from($buttons, button => button.textContent) // ['text', 'text'] | |
// Find something in an array | |
const arr = [1, 2, 8] |
const arr = [1, 2, 3]; | |
// Reduce to object | |
const obj = arr.reduce((all, item, index) => { | |
// do something with item and all | |
all[index] = item; | |
// return all | |
return all; | |
}, {}); |
let foo = false; | |
toggle = val => val = !val; | |
$thing.on('click', () => foo = toggle(foo)); |