Skip to content

Instantly share code, notes, and snippets.

@matthewmueller
matthewmueller / custom-capslock.json
Last active October 23, 2019 09:25
Change caps_lock to command+control+option+shift or F19 if tapped.
{
"title": "Change caps_lock to command+control+option+shift or F19 if tapped",
"rules": [
{
"description": "Change caps_lock to command+control+option+shift or F19 if tapped",
"manipulators": [
{
"from": {
"key_code": "caps_lock",
"modifiers": {
@matthewmueller
matthewmueller / custom-capslock.json
Created October 23, 2019 09:12
Change caps_lock to command+control+option+shift or F19 if tapped
{
"title": "Change caps_lock to Esc and Control",
"rules": [
{
"description": "Change caps_lock to command+control+option+shift or F19 if tapped",
"manipulators": [
{
"from": {
"key_code": "caps_lock",
"modifiers": {
@matthewmueller
matthewmueller / Readme.md
Last active September 18, 2019 21:48
Inlets Unit file for Amazon Linux 2
@matthewmueller
matthewmueller / index.js
Created March 12, 2019 09:42
async constructors
class Car {
constructor() {
return Promise.resolve(this.new())
}
async new() {
await this.sleep(1000)
this._wheels = 4
return this
}

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 February 16, 2018 21:26
Nice little function to split by slashes while ignoring slashes inside quotes (e.g. /Invoices/"Invoice (9/1)"/invoice.txt)
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):
/*******************************
Flex Layout
*******************************/
.layout.horizontal,
.layout.horizontal-reverse,
.layout.vertical,
.layout.vertical-reverse {
display: -ms-flexbox;
display: -webkit-flex;
package main
func main() {
task := model.NewTask()
err := task.Create(model.Task{
Rate: "* * * * *",
Key: "hi world",
})
}
<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 November 14, 2016 03:52
vnode hook in action
/**
* 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