Skip to content

Instantly share code, notes, and snippets.

View baransu's full-sized avatar

Tomasz Cichocinski baransu

View GitHub Profile
@baransu
baransu / OfferComponents.re
Created January 12, 2019 21:55
re-formality complex dynamic form example
module Part = OfferPart;
module Button = OfferButton;
module Styles = OfferStyles;
module Form = OfferForm;
module PartButton = {
let component = ReasonReact.statelessComponent(__MODULE__);
let make =
(
~actions: array(Action.t),
@baransu
baransu / gen-reason-react-bindings.js
Created July 27, 2018 22:17
[WIP] Generate ReasonReact bindings
// @noflow
const { compile, format } = require("reasonably-typed");
const fs = require("fs");
const COMPONENTS = [
"Button",
"Card",
"Center",
"Checkbox",
Error: node_modules/redux-persist/lib/createPersistoid.js.flow:38
38: timeIterator = setInterval(processNextKey, throttle)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ IntervalID. This type is incompatible with
23: let timeIterator: ?number = null
^^^^^^ number
Error: node_modules/redux-persist/lib/createPersistoid.js.flow:46
46: if (timeIterator) clearInterval(timeIterator)
^^^^^^^^^^^^ number. This type is incompatible with the expected param type of
732: declare function clearInterval(intervalId?: IntervalID): void;
const WithColor = ({ children }) => {
const color = /* advanced compuation as fuck */
return children(color);
}
// nasz Component ktory korzysta z render propsow
const Component = () => {
render (
<WithColor>
const Component = (props) => {
return <div props1={props.props1} props2={props.props2}>{props.children}</div>
}
// lub alternatywnie
const Component = ({ children, ...props}) => {
return <div {...props}>{props.children}</div>
}
// no i nasz HOC - higher order component, przyjmuje style i component i zwraca nam nowy component
// easy
let
matherfuckingComplicated = ...
a = 1
in
if True then
a
else
matherfuckingComplicated
stirling :: Int -> Int -> Int
stirling n 0 = 0
stirling n 1 = 1
stirling n k
| n == k = 1
| k > n = 0
| otherwise =
stirling (n - 1) (k - 1) + k * stirling (n - 1) k
@baransu
baransu / erlang_perf_lab_ideas.md
Last active May 10, 2017 15:55
Ideas for Erlang Performance Lab features

General ideas

Supervision tree

  • Notify about traversing tree errors (which_children timeout)
  • Labels
{
"displayName": "edge",
"entryNode": "a@127.0.0.1",
"name": "edge",
"renderer": "global",
"connections": [
{
"metrics": {
"danger": 0,
"normal": 0,