Skip to content

Instantly share code, notes, and snippets.

@calebmer
calebmer / README.md
Created November 7, 2016 16:17
Caleb’s Open Source Software Feature Wishlist

Caleb’s Open Source Software Feature Wishlist

Every once and a while there will be a feature in open source software that I (Caleb) want, but needs a PR to implement. This document is a collection of issues around such features. This list is to track such features and allow me, or others, to find issues to fix whenever the time and interest arises.

Some issues will be easier than others, but hopefully all are more then possible given an afternoon. Ideally the issue has enough context to get rolling.

@calebmer
calebmer / react-hot-loader.d.ts
Created May 15, 2016 22:14
React Hot Loader 3 Typings
declare module 'react-hot-loader' {
import React = __React
interface AppContainerProps {
children?: React.ReactElement<any>
}
export class AppContainer extends React.Component<AppContainerProps, {}> {}
}
@calebmer
calebmer / 01-query-1.graphql
Last active March 6, 2017 21:47
GraphQL AST
{
luke: person(id: \"cGVvcGxlOjE=\") {
height
mass
species {
name
classification
}
}
}
@calebmer
calebmer / postgrest-auth.md
Last active November 2, 2023 17:53
PostgREST Auth Protocol

This document is a work in progress. Any comments would be extremely helpful and appreciated!

PostgREST Auth Protocol

This document will describe an authentication framework very loosely based on the OAuth2 specification for a seperate authentication server to be used with the main PostgREST resource server. As PostgREST is going in a layered direction, this authentication layer must be interchangeable with other authentication implementations.

Options

  • The first parameter (same as PostgREST) must be a PostgreSQL database connection string.
  • -p, --port [number]: The port on which the server will listen for HTTP requests. Defaults to 3001.
  • -u, --user-relation [relation]: The relation (table or view) which PostgREST Auth will use for generating JWTs. If the relation is a view, it is recommend that it be auto-updateable. Must be user defined. The default is postgrest.users.
  • -r, --refresh-relation [relation]: The relation where PostgREST Auth will st
@calebmer
calebmer / resources.md
Last active December 3, 2015 22:57
Sample PostgREST JSON Hyperlink Schema
@calebmer
calebmer / schema.sql
Created November 11, 2015 15:23
A subset of a PostgREST schema
CREATE SCHEMA private;
CREATE TABLE private.person (
id serial PRIMARY KEY,
email varchar(128) NOT NULL UNIQUE CHECK ( email ~* '^.+@.+\..+$' ),
given_name varchar(64) NOT NULL CHECK ( LENGTH(given_name) >= 2 ),
family_name varchar(64) CHECK ( LENGTH(family_name) >= 2 ),
image varchar(128),
created_at timestamp NOT NULL DEFAULT NOW(),
password_hash char(60)
@calebmer
calebmer / router-benchmark.js
Last active October 19, 2015 00:30
pillarjs/router benchmarks
'use strict'
var http = require('http')
var request = require('supertest')
var Router = require('router')
var finalhandler = require('finalhandler')
var N = parseInt(process.env.N, 10)
var router = Router()
@calebmer
calebmer / future.js
Last active August 29, 2015 14:26
The future of web apps in node
/*
* Next generation of building HTTP apps in NodeJS. Implements the HTML
* streaming API through ES6 generators. ES7 async functions are used to fetch
* data.
*
* Why is this a good idea?
* 1) It is beautiful. You setup a consistent API backend and your frontend
* backend (tongue twister) just looks like this. Layout implementations
* would be a bit odd, but it harkens back to plain old PHP 'require's.
* 2) Most modern, ES6, ES7, streams. All the new pretties.
@calebmer
calebmer / results
Last active October 29, 2023 05:13
Object.setPrototypeOf vs Object.create benchmark test
Iteration(s): 0
==================================
Object.create: 0
Object.setPrototypeOf: 0
Iteration(s): 1
==================================
Object.create: 0
Object.setPrototypeOf: 0.04
@calebmer
calebmer / _utils.scss
Created February 26, 2015 12:15
A set of utilities I use with my sass
// ==================
// Misc
// ==================
$infinity: 9999;
@mixin clearfix() {
&:before,
&:after {
content: "";