This file contains 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
console.clear(); | |
var sample = { | |
a: 'this is something', | |
b: { | |
c: { | |
d: { | |
e: 'this is something', | |
f: [ | |
'this is something', |
This file contains 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 React from 'react'; | |
import IsometricGrid, { Cell } from 'react-isometric-grid'; | |
import dynamics from 'dynamics.js'; | |
const getRandomInt = (min, max) => | |
Math.floor(Math.random() * (max - min + 1)) + min; | |
const properties = pos => ({ | |
translateZ: (pos + 1) * 30, | |
rotateZ: getRandomInt(-4, 4), |
This file contains 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
<html> | |
<body> | |
<pre></pre> | |
<script> | |
const output = document.querySelector('pre'); | |
const url = 'http://163.172.172.242:4242/challenge/survey'; | |
const size = 100; | |
const initial = 1; | |
const indexes = { | |
records: [], |
This file contains 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 convert = seconds => [36000, 3600, 600, 60, 10, 1].reduce( | |
({ seconds, label }, unit) => { | |
const difference = Math.floor(seconds / unit); | |
return { | |
seconds: seconds - (difference * unit), | |
label: label + difference | |
}; | |
}, | |
{ seconds, label: '' } |
This file contains 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
// https://jsfiddle.net/2we0rmox/ | |
const clear = type => filter => filter.type !== type; | |
const add = filter => ({ filters }) => { | |
const current = filters.filter(clear(filter.type)); | |
return { | |
filters: !filter.value ? current : current.concat(filter), | |
}; |
This file contains 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 test = [[1, [2, [3]]], 4]; | |
const dig = (stack, object) => | |
Array.isArray(object) ? flatten(object, stack) : stack.concat(object); | |
const flatten = (input, output = []) => input.reduce(dig, output); | |
console.clear(); | |
console.log(flatten(test)); // [1, 2, 3, 4] |
This file contains 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
export const mock = () => ({ | |
a: () => {}, | |
b: () => {}, | |
c: () => {}, | |
d: { | |
e: { | |
f: () => {}, | |
g: { | |
h: { | |
i: () => {} |
This file contains 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
<h1>Usage</h1> | |
<div id="docs"> | |
<pre> | |
<code class="language-js"> | |
<Modal> | |
{({ Container, Title, Content, Footer }) => ( | |
<Container> | |
<Title> | |
<marquee>Hello, world!</marquee> |
This file contains 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 last from "lodash/last"; | |
import React, { Fragment } from "react"; | |
import { useSlot, useLog } from "nodh"; | |
// your service (async operation) | |
const fetchGithubRepos = () => | |
window | |
.fetch("https://api.github.com/search/repositories?q=react") | |
.then(response => response.json()); |
This file contains 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 React from "react"; | |
import { Provider as Curse } from "nodh"; | |
import YourApp from "./app"; | |
// it works 👍 | |
export default ( | |
<Curse> | |
<YourApp /> | |
</Curse> |