Skip to content

Instantly share code, notes, and snippets.

View matthewstokeley's full-sized avatar
🎯
Focusing

Matthew Stokeley matthewstokeley

🎯
Focusing
View GitHub Profile
@matthewstokeley
matthewstokeley / dom-sibling-query-sketch.js
Last active March 22, 2020 14:58
query dom siblings + sibling children w/o traversal with a function macro pattern
// an alternative to traversal
// https://github.com/matthewstokeley/dom-traversal
// @version 0.0.3
_.castArr = function(
list: NodeList
): Array {
return Array.prototype.splice.call( list )
}
@matthewstokeley
matthewstokeley / data-model.md
Last active April 29, 2020 14:22
data model writeup

The data model for data-binding

Data models contain the entirety of application state (from the elm-lang guide - "The point of the model is to capture all the details about your application as data." )

An Object Literal

A model could be as simple as a plain javascript object

@matthewstokeley
matthewstokeley / elm-one-sheet
Created February 24, 2020 13:51
elm-one-sheet
https://docs.google.com/document/d/1-gw6591eW5WZLy6PU4EcUDfOIlFSi4iiZJVkqhoLpV0/edit?usp=sharing
/*> Click Handler Middleware */
// @version 0.0.3
// CHANGELOG
// 0.0.3 add type scaffolding
type Next = function():void {}
interface Target {
@matthewstokeley
matthewstokeley / fetch-wrapper.js
Last active April 6, 2020 17:54
a robust application lifecycle built around the fetch web api
// quick sketch
/**
* Contextual piping
* @todo create a method to mimic a piping operator
*/
const pipe = function() {
let res
for ( let i = 0; i < this.length; i++ ) {
@matthewstokeley
matthewstokeley / google-list.md
Last active April 14, 2020 10:59
google prep bookmarks
@matthewstokeley
matthewstokeley / symbol-keys.js
Last active February 20, 2020 15:30
Symbol keys
// immutable, unique symbols are used for keys.
let key = new Symbol("md5")
const hashTable = {
[key] : {}
}
@matthewstokeley
matthewstokeley / object-mutator-for-event-driven-data-mapping.js
Last active September 29, 2020 12:12
an object mutator for functional, compositional event-based data mapping with dependency injection and closures
// an object mutator for a functional, compositional event-based data mapper with closures
const store = {}
const shallowCloneObject = store => Object.assign({}, store)
// const store = shallowCloneObject(original)l
function defineProperty (
object: Object,
@matthewstokeley
matthewstokeley / pure-function-patterns.md
Created February 14, 2020 14:01
pure-function-patterns

/**
 * ht vue, lo
 * Cache a function
 */
function cached (
  fn: Function,
  resolver: Function
): Function {

Deep diving hyper's event system

@link pure-programming-with-hyper-app
  ```

This is the generated function that is passed inside of the event-systems payload

  ```	
wrap = function ( data ) {