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 / Readme.md
Last active Sep 18, 2019
Inlets Unit file for Amazon Linux 2
View Readme.md
@matthewmueller
matthewmueller / osx-for-hackers.sh
Last active Sep 10, 2019
OSX for Hackers (Mavericks/Yosemite)
View osx-for-hackers.sh
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
@matthewmueller
matthewmueller / escape-json.js
Created Aug 25, 2012
Escape JSON strings before trying to run JSON.parse
View escape-json.js
/*
Escape JSON
*/
var escapeJSON = exports.escapeJSON = function(json) {
var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
var meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
@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):
@matthewmueller
matthewmueller / index.html
Last active Jan 11, 2018
HTML Starter Template for rock-solid Web Apps
View index.html
<!--
What?
HTML Starter Template for rock-solid Web Apps
Where?
Get the latest template here: https://gist.github.com/matthewmueller/cb33e2c5f6834511cd45f17b59271052
View bookmarklet.js
javascript:(function () {var script = document.createElement('script');script.setAttribute('src', 'https://raw.github.com/gist/3713207/$FILEPATH');document.body.appendChild(script);}());
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",
})
}
You can’t perform that action at this time.