Skip to content

Instantly share code, notes, and snippets.

@bstro
bstro / application.scratch
Created February 15, 2018 01:53
New Twiddle
<div style="width: 500px; height: 200px; overflow: scroll; border: 1px solid #CCC">
<div style="width: 800px;">
{{#table-grid
fixedGridTemplateColumns="11em 4em"
fixedGridTemplateRows="3em"
cellClassNames="bg-white"
columnClassNames=(array "first-column")
rowClassNames=(array "first-row" "second-row" "third-row")
customCellClass=evenOrOddClassNames
@bstro
bstro / bug.re
Last active March 6, 2018 18:45
open ApolloLinks;
open ApolloInMemoryCache;
type dataObject = {
.
"__typename": string,
"id": string,
"key": string
};
@bstro
bstro / README.md
Last active May 21, 2018 12:45
simple selector middleware devtool

This is a simple pattern I follow that helps maintain an easily accessible graph of all derived data flowing through a Redux application, and expose that derived data (as well as the Redux state itself) to the global window object in the browser's console.

selectorMiddleware.js

computes selectors and sets the derived data on the window object, visible at window.selectors

stateMiddleware.js

simply exposes the redux state to the window object at window.state. nothing crazy here

configureStore.js

apply the two middlewares

import Ember from 'ember';
import computedStyle from 'ember-computed-style';
export default Ember.Component.extend({
classNameBindings: ['type', 'proficiency'],
classNames: ['assessment-timeline-node'],
attributeBindings: ['style'],
import Ember from 'ember';
import computedStyle from 'ember-computed-style';
export default Ember.Component.extend({
classNames: ['assessment-timeline-node'],
classNameBindings: ['type', 'proficiency'],
attributeBindings: ['style'],
style: computedStyle('percentageX'),
@bstro
bstro / parse.elm
Last active January 15, 2019 03:24
-- My goal here is to be able to parse a string like "678767".
-- However, this same parser needs to be able to handle a string like "18.1.2.4"
-- My strategy is this: I parse the input as an integer.
-- If the parser has reached the end of the string, tag the chomped value as XXXXXX (see Index type below)
-- If the parser instead reaches a `.`, continue and recursively capture every integer following a `.`
-- Tag the resulting Int and List Int with XX. (see Index type below)
-- Also, I'm not sure, but I think line 16 needs this type:
-- dotDigit : List String -> Parser.Parser (Step (List Int) (List Int))
@bstro
bstro / parser.elm
Created February 9, 2019 20:18
parser.elm
parseStep : List Int -> Parser (Step (List Int) (List Int))
parseStep acc =
oneOf
[ end |> map (\_ -> Done (List.reverse acc))
, chompWhile Char.isDigit
|> getChompedString
|> andThen
(\s ->
case String.toInt s of
Just n ->
module Data exposing (data)
data = { title = "Steppenwolf", author = "Hesse"
, pages = 237 }
#lang pollen
◊; I have a custom tagged called `digram`. I use it like this:
◊digram{◊(lesser-yin)}
◊; I use this to render these characters: ⚌ ⚍ ⚎ ⚏
◊; I will be using these all over my document, but in this specific
◊; case, I need to render them much like they appear above: in a row.
◊; Eventually I will be rendering to HTML, Latex, PDF, and JSON (if I can
◊; figure out how). But for now, I am just concerned with HTML. I started
◊; located in the root folder of my project, adjacent to template.html.p
#lang pollen
front/cover.poly.pm
front/author_note.poly.pm
body/1_understanding_the_names.poly.pm
body/2_understanding_the_lines.poly.pm
body/3_the_trigrams.poly.pm
body/4_growth_needs_decay.poly.pm