Skip to content

Instantly share code, notes, and snippets.

// Package preact provides bindings to the preact library.
package preact
import "github.com/gopherjs/gopherjs/js"
var preact = js.Global.Get("preact")
// Attrs of an element.
type Attrs map[string]interface{}
input[type="search"]::-webkit-search-cancel-button {
--size: 11px;
--background: #7F7F7F;
--icon: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3IiBoZWlnaHQ9IjciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjMiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgY2xhc3M9ImZlYXRoZXIgZmVhdGhlci14Ij48cGF0aCBkPSJNMTggNkw2IDE4TTYgNmwxMiAxMiIvPjwvc3ZnPgo=");
-webkit-appearance: none;
height: var(--size);
width: var(--size);
border-radius: 50%;
background: var(--background) var(--icon) 50% 50% no-repeat;
}
@tj
tj / Makefile
Created September 21, 2011 03:04
index.html: docs/index.md
markdown < $< \
| cat head.html - tail.html \
> $@
@tj
tj / enums.go
Last active August 19, 2020 18:40
type User enum {
Authenticated struct {
Name string
}
Anonymous struct {}
}
// and/or
type Authenticated struct {
@tj
tj / colors.css
Created December 9, 2016 17:09
open-color css modules
/* Gray */
@value gray-0: #f8f9fa;
@value gray-1: #f1f3f5;
@value gray-2: #e9ecef;
@value gray-3: #dee2e6;
@value gray-4: #ced4da;
@value gray-5: #adb5bd;
@value gray-6: #868e96;
@value gray-7: #495057;
input[type="search"]::-webkit-search-cancel-button {
--size: 11px;
--background: #7F7F7F;
--icon: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3IiBoZWlnaHQ9IjciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjMiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgY2xhc3M9ImZlYXRoZXIgZmVhdGhlci14Ij48cGF0aCBkPSJNMTggNkw2IDE4TTYgNmwxMiAxMiIvPjwvc3ZnPgo=");
-webkit-appearance: none;
height: var(--size);
width: var(--size);
border-radius: var(--size);
background: var(--background) var(--icon) 50% 50% no-repeat;
}
@tj
tj / lambda.md
Last active May 29, 2020 16:06
Lambda proposal

The goal is for the next version of Up to provide all of the runtimes which Lambda already supports. Up lets users write regular HTTP servers, using any framework they prefer. Up works by translating Lambda events to and from HTTP requests, using a Go proxy inside of the Lambda.

Currently Lambda imposes limitations which prevent this from working well with all runtimes, since the Go proxy needs to be the handler, while the runtime files/interpreters still need to be present.

I see two solutions to this problem, the first is to expose the existing runtimes as layers, allowing the proxy to live in a "provided" runtime, but still reference the others for their files. The second is to allow layers to act as the entrypoint/bootstrap, while still allowing the user to select an existing runtime as they normally would, just giving precedence to the layer.

Thanks!

@tj
tj / error
Created September 21, 2010 05:11
if foo
if bar
something
else
something_else
else
baz
@tj
tj / stylus.md
Created January 13, 2012 19:14

Stylus

A dynamic, expressive, powerful language compiling to CSS.

SLIDE:

whoami

tj holowaychuk

@tj
tj / foo.js
Created October 30, 2012 05:08
Stream example
var fs = require('fs')
function cat(file) {
var stream = fs.createReadStream(file)
stream.setEncoding('utf8')
return function(write){
stream.on('error', write)
stream.on('data', function(d){ write(null, d) })
stream.on('end', write)