Skip to content

Instantly share code, notes, and snippets.

Matthew Mueller matthewmueller

Block or report user

Report or block matthewmueller

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
@matthewmueller
matthewmueller / index.js
Created Mar 12, 2019
async constructors
View index.js
class Car {
constructor() {
return Promise.resolve(this.new())
}
async new() {
await this.sleep(1000)
this._wheels = 4
return this
}
View Readme.md

Installation

yarn add express
node index.js

How to Test

I ran this test on Chrome. To see it getting the flash of unstyled content, you'll need to set the 3G setting in Chrome Dev Tools:

@matthewmueller
matthewmueller / split-by-slash.go
Created Feb 16, 2018
Nice little function to split by slashes while ignoring slashes inside quotes (e.g. /Invoices/"Invoice (9/1)"/invoice.txt)
View split-by-slash.go
func splitBySlash(s string) []string {
lastQuote := rune(0)
slash := rune(filepath.Separator)
f := func(c rune) bool {
switch {
case c == lastQuote:
lastQuote = rune(0)
return false
case lastQuote != rune(0):
View layout.css
/*******************************
Flex Layout
*******************************/
.layout.horizontal,
.layout.horizontal-reverse,
.layout.vertical,
.layout.vertical-reverse {
display: -ms-flexbox;
display: -webkit-flex;
View main.go
package main
func main() {
task := model.NewTask()
err := task.Create(model.Task{
Rate: "* * * * *",
Key: "hi world",
})
}
View index.html
<style id="jsbin-css">
.form {
font-size: 1em;
color: #4C4C35;
box-sizing: border-box;
}
.form, .form * {
box-sizing: border-box;
}
@matthewmueller
matthewmueller / preact.js
Created Nov 14, 2016
vnode hook in action
View preact.js
/**
* Module dependencies
*/
const stringify = require('preact-render-to-string')
const preact = require('preact')
const h = preact.h
preact.options.vnode = function (node) {
if (!node.attributes || !node.attributes.class) return
@matthewmueller
matthewmueller / index.js
Last active Oct 28, 2016
Basic scaffolding for monorepos
View index.js
/**
* Module dependencies
*/
/**
* Export `__NAME__`
*/
View failing.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.vcom = factory());
}(this, (function () {
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
You can’t perform that action at this time.