Skip to content

Instantly share code, notes, and snippets.

View ApolloWrapper.js
// @flow
import {Component, type Node} from 'react'
import authenticatedApolloClient from '../shared/authenticatedApolloClient';
/**
* Example usage:
*
* const ScreenWithLoader = (props) => <ApolloWrapper
* queryOptions={{
@jaredly
jaredly / abilities-in-scheme.scm
Last active Jan 28, 2021
This is able to at least handle the "jump between two handlers" aspect of abilities. will see how well I make it through the rest of the test cases. This is run using chicken scheme.
View abilities-in-scheme.scm
(define stack '())
(define (throw-effect k effect)
(let* ((handler (car stack)) (name (car handler)) (fn (cadr handler)))
(set! stack (cdr stack))
(print "Calling " name)
(fn (cons 'effect (cons k effect)))
)
)
@jaredly
jaredly / App.re
Last active Jan 1, 2021
ReasonReact Context API Example
View App.re
module StringContext =
Context.MakePair({
type t = string;
let defaultValue = "Awesome";
});
let component = ReasonReact.statelessComponent("Tree");
let make = _children => {
View codemirror.cljs
(defn code-mirror
"Create a code-mirror editor. The parameters:
value-atom (reagent atom)
when this changes, the editor will update to reflect it.
options
:style (reagent style map)
will be applied to the container element
:js-cm-opts
options passed into the CodeMirror constructor
:on-cm-init (fn [cm] -> nil)
View all unison docs.md

All the docs probably

base..

.> view base..

  (base..) : (b ->{𝕖} c) -> (a ->{𝕖} b) -> a ->{𝕖} c
  (base..) f g x = f (g x)
@jaredly
jaredly / neovim.svg
Created Feb 25, 2014
A few concepts for a NeoVim logo
View neovim.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jaredly
jaredly / BasicServer.re
Created Jan 2, 2018
Simple Static File Server in Reason/OCaml
View BasicServer.re
let recv = (client, maxlen) => {
let bytes = Bytes.create(maxlen);
let len = Unix.recv(client, bytes, 0, maxlen, []);
Bytes.sub_string(bytes, 0, len)
};
let parse_top = top => {
let parts = Str.split(Str.regexp("[ \t]+"), top);
switch (parts) {
@jaredly
jaredly / example.re
Created Jul 30, 2019
Reason Macros example
View example.re
// Reason Macros!
// Use templates to write your code for you.
let%macro add5 = (input: ident, log: string) => {
if%eval (env("node_environment") != "production") {
Js.log(eval__input)
};
eval__input + 5
};
View gist:a5e0102c060b7a1b40525d41f87843a8
let module Styled = {
let module Create (Config: {
let name: string;
let style: ReactNative.Style.style;
}) => {
let component = ReasonReact.statelessComponent Config.name;
let make ::paddingVertical=? => {
let style = combineStylesSomeHow Config.style paddingVertical; /* <- this is an optional btw */
View.make ::style
View current.m
CAMLprim value fluid_create_ScrollView(value dims_v) {
CAMLparam1(dims_v);
CAMLlocal1(view_v);
log("Create scroll view\n");
Unpack_record4_double(dims_v, left, top, width, height);
NSRect frame = NSMakeRect(left, top, width, height);
NSScrollView* view = [[NSScrollView alloc] initWithFrame:frame];