Skip to content

Instantly share code, notes, and snippets.

Glen Maddern geelen

Block or report user

Report or block geelen

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
View gist:127e1e9dbeee080f00bbddba4b2f8182
type Query = {
book(id: ID!): Book!
author(id: ID!): Author!
}
type Book = {
id: ID!
name: String
author: Author
}
View lambda@edge vs cloudflare workers.sh
root@vps190992:~/go/bin# ./hey https://serverless-ssr.now.sh/ssr/preact
Summary:
Total: 14.7408 secs
Slowest: 6.9887 secs
Fastest: 0.2357 secs
Average: 1.9901 secs
Requests/sec: 13.5678
View giftunnel.js
(async () => {
const rows = 44
const cols = 36
const fps = 12
const gif = "http://i.imgur.com/ifR7csn.gif"
const rotate = false
const mirror = false
const vertmirror = false
document.body.innerHTML = ''
View idontwanttolosethis.js
(async () => {
const cols = 44
const rows = 36
const size = 90
const speedX = 0.02
const speedY = 0.0
const loadImage = url => {
const img = document.createElement('img')
View chain.js
const chain = rules => {
class ChainLink {
constructor(rules) {
this.rules = rules;
}
toString() {
return this.rules
}
}
@geelen
geelen / _.md
Last active Mar 1, 2019
Sync a document from Bear Writer's DB to a file on disk
View _.md

Sync a document from Bear Writer's DB to a file on disk

I really like Bear Writer's interface, but it stores all its notes in an SQLite DB. I spent ages rigging up a nice Markdown + Webpack pipeline for a React blog before I realised this, and rather than admit my mistake, potentially pushing forward to concentrate on the content rather than procrastinating on the pipeline, I built this.

Screenshot showing copying the doc id

Grab the Document ID from Bear, then run:

yarn add sqlite3 untildify
View stylable-components.md

stylable-components

CSS for Components

Example

/* Counter.css */
@import Button from './Button.css';
@geelen
geelen / index.html
Last active Apr 9, 2017
Query selector speed comparison #jsbench #jsperf (https://jsbench.github.io/#c4cb4c2d5578e5e3900743d117538ec8) #jsbench #jsperf
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Query selector speed comparison #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
View cm2sc.js
import React from 'react'
const cm2sc = names => Object.keys(names).reduce((comps, name) => (
{ ...comps, [name]: ({is = 'div', className, ...props}) => (
React.createElement(is, { ...props, className: [names[name], className].filter(_=>_).join(' ') })
) }
), {})
export default cm2sc
View blend mode example.js
// Doesn't work unless the image host accepts CORS
window.download = a => {
const { opacity, country, blendMode } = current
const canvas = document.createElement('canvas')
canvas.width = 1280
canvas.height = 720
const ctx = canvas.getContext('2d')
ctx.clearRect(0, 0, 1280, 720)
ctx.globalCompositeOperation = 'source-over'
You can’t perform that action at this time.