Skip to content

Instantly share code, notes, and snippets.

View broerjuang's full-sized avatar
🏠
Working from home

Juang Wiantoro broerjuang

🏠
Working from home
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<script
crossorigin
src="https://unpkg.com/react@16/umd/react.production.min.js"
@broerjuang
broerjuang / todolist.re
Created January 5, 2019 10:16
Trying out Revery TodoList
open Revery.UI;
open Revery.UI.Components;
open Revery.Core;
open Revery.Core.Window;
open Revery.Core.Events;
open Revery.Core.Key;
type todo = {
id: int,
@broerjuang
broerjuang / reduct.js
Created November 14, 2018 02:54
Reduct (Simple implementation of Redux)
/*
Combine reducers actually a function that takes
an object that has shape
type Reducer = (state, action) => state;
{
[key: string]: Reducer
}
@broerjuang
broerjuang / navigation.re
Created October 16, 2018 12:36
Experimentation with Navigation
module Navigation = {
type actions = {pop: unit => unit};
[@bs.deriving abstract]
type navigation;
[@bs.send]
external navigate:
(navigation, ~routeName: string, ~params: Js.t({.})=?, unit) => unit =
"navigate";
@broerjuang
broerjuang / routes.js
Last active September 15, 2018 16:35
// @flow
/* eslint-disable */
import * as React from 'react';
import {
EvilIcons as Icon,
MaterialCommunityIcons as MIcon,
} from '@expo/vector-icons';
import {
createStackNavigator,
@broerjuang
broerjuang / asyncAction.js
Last active September 13, 2018 19:23
Redux Context
async function getUsersAsync(dispatch) {
dispatch({ type: "FETCH_REQUESTED" });
try {
let data = await fetch("https://api.github.com/users").then(res =>
res.json()
);
dispatch({ type: "FETCH_SUCCEED", data });
} catch (error) {
dispatch({ type: "FETCH_FAILED", error: error });
}
@broerjuang
broerjuang / fractalsTree.re
Created June 9, 2018 08:56
Fractals Tree
open Reprocessing;
module Constants = {
module Window = {
let width = 600;
let height = 600;
};
module Color = {
let black = Constants.black;
@broerjuang
broerjuang / simpleFractalRec.re
Created June 8, 2018 19:34
simple fractal 1
open Reprocessing;
let width = 640;
let height = 360;
let rec drawRec = (~x, ~y, ~dimension, env) => {
Draw.stroke(Constants.black, env);
Draw.strokeWeight(1, env);
Draw.noFill(env);
Draw.rect(~pos=(x, y), ~width=dimension, ~height=dimension, env);
@broerjuang
broerjuang / ReactNativeWeb.re
Created May 4, 2018 05:37
Binding of react native web
let option_map = (fn, opt_value) =>
switch (opt_value) {
| None => None
| Some(value) => Some(fn(value))
};
module View = {
[@bs.module "react-native-web"]
external _view : ReasonReact.reactClass = "View";
let make =
module Utils = {
let rec repeat = (whatToRepeat, howManyTimes) =>
switch howManyTimes {
| 0 => ""
| someNumber when howManyTimes > 0 => whatToRepeat ++ repeat(whatToRepeat, howManyTimes - 1)
| _ => ""
};
let rec makePairFromList = (xs) =>
switch xs {
| [] => []