Skip to content

Instantly share code, notes, and snippets.

@nathanhammond
nathanhammond / kCantonese.diff
Last active July 7, 2021 11:33
Comparing pronunciations from JPTableFull.pdf and Unihan kCantonese.
diff --git a/JPTableFull.pdf b/kCantonese.txt
--- a/JPTableFull.pdf
+++ b/kCantonese.txt
-U+3439 㐹 kCantonese ngat6 1
-U+3439 㐹 kCantonese at6 2
+U+3439 㐹 kCantonese hei3
-U+3529 㔩 kCantonese ap1 1
-U+3529 㔩 kCantonese ngap1 2
@nathanhammond
nathanhammond / state-machine.js
Created August 27, 2020 09:07
XState Next test case
/*
Run against HEAD of `next`.
The console output will likely make the order of operations clear, it is designed to try and guide you through the behavior.
Two issues:
- The first invoked promise does not trigger a done event, so the timeout catches and that state node re-enters.
- The `assign` for the later state (spawn) is running before an action for the previous state (reset).
One curiousity:
@nathanhammond
nathanhammond / machine.js
Created August 19, 2020 06:39
Generated by XState Viz: https://xstate.js.org/viz
(function (xstate, constants) {
'use strict';
/**
* Leaf state condition generator.
*
* @param {String} target the target state
*/
function matchLeafState(target) {
return {
var windowId = 0;
function windowManager() {
return Machine({
id: 'window-manager',
initial: 'idle',
type: 'parallel',
states: {
idle: {
@nathanhammond
nathanhammond / controllers.application.js
Last active October 16, 2018 18:36
Checked Binding
import Ember from 'ember';
export default Ember.Controller.extend({
radioValue: 'one',
display: Ember.computed('radioValue', function() {
return JSON.stringify(this.get('radioValue'));
}),
actions: {
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@nathanhammond
nathanhammond / router.js
Last active February 23, 2018 18:09
willBeActive
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('products', function() {
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: ['something'],
filter: null,
actions: {
reloadList() {
this.transitionToRoute('list.details', { queryParams: { filter: 'hello' } });
},
import Ember from 'ember';
export default Ember.Controller.extend({
value: {
id: 12,
name: 'james'
}
});