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 / javascript-native-array-methods-in-5.md
Last active April 16, 2020 00:08
javascript-native-array-methods-in-5.md

wip needs editing

// native array methods are functions attached to the prototype of the variadic constructor or object literal, and are inherited via prototypal inheritance
Array.prototype[METHOD].call, [].prototype[METHOD].call, let arr_ = [1,2,3]; arr[METHOD].call
// the common argument pattern for methods is VIA: value, index, array
[].forEach((value, index, array) => value++)
@matthewstokeley
matthewstokeley / inversion-of-control-poc.js
Last active April 15, 2020 01:44
inversion of control pattern for object-oriented javascript
// the simplest possible example of inversion of control
class IOC
{
/*
* @type {string}
*/
classProperty: 'hello world'
constructor(/** Function */ fn) {
@matthewstokeley
matthewstokeley / object-oriented-prototypal-javascript-in-5-seconds.md
Last active April 15, 2020 01:39
object-oriented-prototypal-javascript-in-5-seconds

Prototypal Javascript

// this is like a constructor
const Oopj = function() {}
// inherits or implements a built-in prototype object
console.log(Oopj.prototype);
@matthewstokeley
matthewstokeley / google-list.md
Last active April 14, 2020 10:59
google prep bookmarks
@matthewstokeley
matthewstokeley / hasAttr.js
Last active April 13, 2020 14:01
does an element have an attribute
// has
const hasAttr = ( _el, attr ) => {
if ( ! 'children' in _el || _el.children[ 0 ] ) {
return false;
}
if ( _el.nodeType !== 1) {
return false;
@matthewstokeley
matthewstokeley / bootloader.js
Last active April 8, 2020 18:05
bootloading a transpiler
#! /usr/bin/node
/* ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
* Bootload a Transpiling Environment
*
* @version 0.0.2
*/
/* ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
* Declare Modules
@matthewstokeley
matthewstokeley / delegation-pattern.js
Last active April 7, 2020 13:34
Delegation design pattern
// #### Delegation
// A SOLID method is delegated via composition.
/**
*
*/
type Subtask: Function(name: String): Function
/**
// an incredibly quick sketch
// goal: a 4-line version of redux
// 0.0.1
// actions
const ACTIONS = {
"nav-toggle": "BIND_NAV_TOGGLE"
}
@matthewstokeley
matthewstokeley / template-caching-handler.js
Last active April 7, 2020 00:41
persistence layer integration
/*_________________________________________________________
*
* @version 0.0.2
*/
( function( $ ) {
const KEY = 'template-name'
const HTML_KEY = 'html'
const CONTAINER = '.container'
@matthewstokeley
matthewstokeley / .babelrc
Last active April 7, 2020 00:32
Modern Javascript UI Component Babel Config
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": ["babel-plugin-styled-components"],
"ignore": []
}