Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Doing things

Matthew Phillips matthewp

💭
Doing things
View GitHub Profile
@matthewp
matthewp / Makefile
Created Jul 7, 2020
Lambda makefile
View Makefile
main.zip: main.js package.json package-lock.json src lib node_modules
zip -r $@ $^
clean:
@rm -f main.zip deploy.json
.PHONY: clean
deploy.json: main.zip
aws lambda update-function-code --function-name my-function-name --zip-file fileb://./$^ > $@
@matthewp
matthewp / demo.js
Created Jun 23, 2020
Import strangeness
View demo.js
let error1, error2;
try {
await import('/mod.js');
} catch(err) {
error1 = err;
}
try {
await import('/mod.js');
@matthewp
matthewp / extensible-web-manifesto.md
Last active Jan 15, 2020
A Proposed Addendum to the Extensible Web Manifesto
@matthewp
matthewp / release-notes.md
Last active Jan 7, 2020
QOSDK Release Notes - ES Export
View release-notes.md

This release adds support for a JavaScript module entry point. If you are using a bundler like webpack this will be used automatically and you do not need to make any changes.

Usage

Usage is described in the readme. In short you can import any of the primary classes like so:

import {
	Menu,
	Cart,
@matthewp
matthewp / .gitignore
Created Dec 31, 2019
Minimal example
View .gitignore
out.mjs
node_modules/
View haunted-notes.md

This is a huge release for Haunted, one of the biggest since the initial release. Before getting into features I want to give some appreciate to @jdin, @Gladear, and @chase-moskal who all made tremendous contributions to this release. That cannot go overstated, I did only a small part of this release, the Haunted community is what keeps this project alive. ❤️ 🎃 . Now that the sappy stuff is complete, on to the features!

State API

At its core Haunted is a container for state and lifecycle callbacks that is derived from hooks like useState, useMemo, even useEffect. With the component() API you get more than just that, you also get a scheduler that handles rendering and committing the result.

A lot of people have wanted to use hooks outside of the context of Haunted components. One example is using hooks inside of a LitElement component. The new State API enables this, by exposing the low-level part of Haunted which is its state container.

View nuxt.config.js
export default {
mode: 'universal',
/*
** Headers of the page
*/
head: {
title: process.env.npm_package_name || '',
meta: [
{ charset: 'utf-8' },
@matthewp
matthewp / fixture.js
Created Sep 10, 2019
Fixtures and schema merging
View fixture.js
let RelativeDate = {
[Symbol.for("can.new")](value) {
if( date === "yesterday" ) {
return new Date()- 1000*24
}
return date;
},
[Symbol.for("can.isMember")](value) {
return value instanceof Date;
}
View machine.js
function valueEnumerable(value) {
return { enumerable: true, value };
}
function valueEnumerableWritable(value) {
return { enumerable: true, writable: true, value };
}
let truthy = () => true;
let empty = () => ({});
You can’t perform that action at this time.