Skip to content

Instantly share code, notes, and snippets.

@jordwalke
jordwalke / myComponent.ml
Last active December 13, 2021 17:32
React OCaml API
open ReactDOM
module MyComponent = struct
(* Component Properties *)
type props = {count: int}
(* Hey, state can be any type! *)
type state = string
(* Initializer *)
@jordwalke
jordwalke / gist:10712353
Created April 15, 2014 08:05
General OCaml Build
#!/bin/sh
set -e
# Just make sure there's a file called fileName.ml in the same directory
TARGET=fileName
# Disabling duplicate record warning (30) and non-opened record field names (40)
FLAGS="-libs unix,nums -cflags -w,-30,-w,-40"
OCAMLBUILD=ocamlbuild
@jordwalke
jordwalke / render.js
Last active August 29, 2015 13:56 — forked from nelix/render.js
var items = this.props.showThings ? this.props.items : [];
return (
<ul>
{items.map(thing => <li>{thing}</li>)}
</ul>
);
@jordwalke
jordwalke / gist:9146647
Created February 22, 2014 00:31
ocamlbuild starter script.
#!/bin/sh
set -e
TARGET=driver
# Disabling duplicate record warning (30) and non-opened record field names (40)
FLAGS="-libs unix,nums -cflags -w,-30,-w,-40"
OCAMLBUILD=ocamlbuild
ocb()
@jordwalke
jordwalke / gist:8857022
Created February 7, 2014 03:30
WebStorm Parse Fail
var x =
<svg
width="100%"
height="100%"
viewBox="0 0 700 700"
version="1.1"
style={{cursor: 'pointer'}}
onMouseDown={this.handleMouseDown}
onMouseUp={this.handleMouseUp}>
{this.renderGraphic(rotationStyle)}
@jordwalke
jordwalke / gist:8682861
Last active January 4, 2016 21:39
React JavaScript: Just Like You've Always Done It (with arrow funcs)
/**
* ReactJS: JavaScript like you've always done it.
*
* This example renders your top ten most followed friends/followers, `filter`ing
* only your favorites, and putting a star on all verified accounts.
*
* With ReactJS, any time your data changes, the UI is always brought up to date
* automatically. If friends length changes, or followCount - it always shows what
* `render` describes.
*/
@jordwalke
jordwalke / gist:6350319
Last active September 10, 2016 16:27
ReactJS: JavaScript just like you've always done it.
/**
* ReactJS: JavaScript like you've always done it.
*
* This example renders your top ten most followed friends/followers, `filter`ing
* only your favorites, and putting a star on all verified accounts.
*
* With ReactJS, any time your data changes, the UI is always brought up to date
* automatically. If friends length changes, or followCount - it always shows what
* `render` describes.
*/
@jordwalke
jordwalke / gist:5944524
Created July 7, 2013 18:59
How to require JSX files in node.js (uses deprecated node.js feature)
require.extensions['.jsx'] = function(module) {
module._compile(reactTools.transform(fs.readFileSync(module.filename, 'utf8')), module.filename);
};