let todo = 'make peace and solve world hunger';
let url = 'http://api.openai.com/v1/_llama?tkn=' + todo;
let { solution } = await JSXHttpRequest().open('POST', url);
eval(solution);
An improvised draft of JSON Expression grammar in ABNF:
JsonExpression = "[" Operator Operands "]" ; JSON-expression is itself a valid JSON array
Operator = JsonLiteral ; Operator is any JSON value, but usually a string
Operands = 1*("," Operand) ; Non-nullary expression has at least one operand
- Ability to match static routes
GET /foo/bar
['GET /foo/bar']
- Ability to match a single step in a route
POST /users/{userId}/edit
orPOST /users/{userId:*/}edit
['POST /users/', match('userId', '*/'), '/edit']
- Ability to wildcard the ending of a route
GET /static/{filename:*}
['GET /static/', match('filename', '*')]
- Ability to make the last route step optional
GET /users{userId?:/*/}
['GET /users']
and
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const enum CONST { | |
MAX_LENGTH = 128, | |
} | |
class BigArrayRef<T> { | |
constructor (public readonly arr: BigArray<T>, public readonly pos: number) {} | |
} | |
export class BigArray<T> { | |
public length = 0; |
146aPdVmwzwzwzWe:)P
14Pd:)P2022
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import λ from "apex.js"; | |
import { Pool } from "pg"; | |
// connection details inherited from environment | |
const pool = new Pool({ | |
max: 1, | |
min: 0, | |
idleTimeoutMillis: 120000, | |
connectionTimeoutMillis: 10000 | |
}); |
Specify required fields, rest will be optional.
export type Required<T, K extends keyof T> = Partial<T> & Pick<T, K>;
Specify which fields to omit.
export type Omit = Pick>;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stop PostgreSQL from auto starting | |
sudo launchctl unload -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.3.plist | |
# Enable PostgreSQL to auto start | |
sudo launchctl load -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.3.plist | |
# Start postgres | |
$ sudo su postgres | |
Password: | |
bash-3.2$ pg_ctl -D /Library/PostgreSQL/9.3/data/ start |
Smallest possible CSS-in-JS library.
- Try demo
- 178 bytes (minified and gzipped)
- Source code fits in a tweet
- Dynamic 4th generation styling
- "jsxstyle" interface
- Pure React — no side effects
PubSub
class like this:
class PubSub {
constructor () {
this.el = document.createElement('div');
}
subscribe (eventName, handler) {
this.el.addEventListener(eventName, handler);
NewerOlder