Skip to content

Instantly share code, notes, and snippets.


Matthew Stokeley matthewstokeley

Block or report user

Report or block matthewstokeley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
matthewstokeley /
Last active Oct 13, 2019
Prototype mutability wip

Object prototype mutability causes memory leaks and is unintuitive. This is why patterns like virtualization via proxies and reflection, functional programming's eschewal of side effects, and reactive vue-style object mutation events are commonly used, especially in conjunction with composition techniques.


This is one possible example of object-based prototypal inheritance, using hasOwnProperty to break the prototype chain.

    const _createElement = _proto => {
        let _el = Document.createElement()
        for (var prop in _proto) {
            if (Object.hasOwnProperty(prop)) {
                _el[prop] = _proto[prop]
matthewstokeley /
Last active Oct 7, 2019
Example PWA manifest

<link rel="manifest" href="/manifest.json">

From the google documemtation:

  "short_name": "Maps",
  "name": "Google Maps",
  "icons": [
      "src": "/images/icons-192.png",

Queries and Mutations


An object property

  hero {
View gist:4f5c8d072eb02a9a5d4670204847b9ec
* Triggers aspect-ratio computation in chromium browsers
@mixin _aspect-ratio
width: 100%
height: auto
matthewstokeley / white-space.sass
Created Sep 13, 2019
a discarded white-space mixin with a robust parameter range
View white-space.sass
@mixin white-space( $options, $vertical: true )
$box-model-white-space: ()
$prop: null
@if ( type-of($options) == 'map' )
@each $rel, $map in $options
@if ( $rel != 'inner' and $rel != 'outer' )
$prop: 'padding'
@each $modifier, $unit in $options
#{ $prop }-#{ $modifier }: #{ $unit }
matthewstokeley /
Last active Sep 29, 2019
the use of an `expected` parameter to mock data values

The expected pattern for handling unknown data sources from React's ssr rendering library, in this case a data-attribute value, provides an alternative to event propagation and graceful degradation for error handling.

  • is the attribute name safe?
    • if no, return
  • does the node have the attribute?
    • if no, return a value of null unless expected is undefined, in which case, return undefined.
  • assign the value of getAttribute
  • is the value equal to an empty string? return expected
    • otherwise, return the value
matthewstokeley / err.js
Last active Oct 2, 2019
error constants definition file
View err.js
* A set of conventional error, exception and warning messages.
* Organized by type and then hierarchically according to specificity, from `SPL`, python and node.js
* @version 0.0.1
* Parameter Error Messages
matthewstokeley / paragraphs.js
Last active Oct 6, 2019
very quick sketch of several services to provide transformation to paragraphs
View paragraphs.js
* Real-time data analysis library
* @ht lewitt
// modularizing paragraphs and allowing granular control over transformation
type TransformationObject {
You can’t perform that action at this time.