Skip to content

Instantly share code, notes, and snippets.

View Mosoc's full-sized avatar
🌐
Globalization, Internationalization and localization

Bruno Antinomio Mosoc

🌐
Globalization, Internationalization and localization
View GitHub Profile
@Mosoc
Mosoc / machine.js
Created May 22, 2020 11:30
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'stubborn',
initial: 'inactive',
states: {
inactive: {
on: {
TOGGLE: {
target: 'active',
// send the TOGGLE event again to the service
actions: send('TOOGLE')
@Mosoc
Mosoc / machine.js
Last active May 21, 2020 08:19
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@Mosoc
Mosoc / machine.js
Last active May 20, 2020 06:10
Generated by XState Viz: https://xstate.js.org/viz
Machine({
"id": "Team Member Status",
"initial": "invited",
"context": {
"retries": 0
},
"states": {
"invited": {
"on": {
"ACCEPT": {
@Mosoc
Mosoc / machine.js
Last active April 17, 2020 07:55
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@Mosoc
Mosoc / machine.js
Created April 17, 2020 05:45
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@Mosoc
Mosoc / machine.js
Created April 17, 2020 03:59
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@Mosoc
Mosoc / machine.js
Last active April 18, 2020 09:53
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@Mosoc
Mosoc / ThisLikeRef.js
Created October 28, 2019 14:32 — forked from dwighthouse/ThisLikeRef.js
Using This-Like Ref Structure to Solve Hook State Updating and Function Reference Problems
import React, { memo, useCallback } from 'react';
import ChildComponent from './wherever/ChildComponent.js';
const updateChild = (props, childId, changes) => {
props.onUpdate({
type: 'childChanged',
childId: childId,
changes: changes,
});
};
@Mosoc
Mosoc / d.md
Last active October 26, 2019 08:14
ASSET

HTTP REQUEST 的成本比 FILE SYSTEM REUEST 還貴 除了 JS 這種 compile 成本超高的外,其他的資源應該盡可能減少 request 數量。

由於 SVG 裡面其實是可以塞 script 進去,拿得到 cookie,會有一些神奇的安全性問題,所以最後 asset 類型的東西盡量放不同域名。

@Mosoc
Mosoc / brainfuck.ts
Created May 4, 2019 14:37 — forked from meenie/brainfuck.ts
A Brainfuck interpreter written in TypeScript
class Brainfuck {
ptr: number = 0
cmdPtr: number = 0
data: number[] = [0]
output: any[] = []
loops: number[] = []
input: string;
arg: string;
argPtr: number = 0;