{{ message }}

Instantly share code, notes, and snippets.

# Jeremy Lu coodoo

Last active Apr 20, 2021
View wallpaper.js
 const fetch = require('node-fetch') const fs = require('fs-extra') const { execSync } = require('child_process') const main = async () => { const query = `nasa,cycling,surfing,underwater,swimming` const size = `1` const order = `latest` const orientation=`landscape` const photoName = 'photo.png'
Created Mar 8, 2021

View example.js
 useHotkey(['Meta', 'c'], () => { console.log( `要跑 1`, ) }) useHotkey(['ctrl', 'c'], () => { console.log( `要跑 2`, ) })
Last active Dec 5, 2020
View sizer.js
 import { PixelRatio, Dimensions, useWindowDimensions } from 'react-native' const to = n => Number(n.toFixed(2)) const { width, height } = Dimensions.get('window') // 將短的那邊視為 width
Last active Nov 27, 2020
Rotation matrix - https://jsfiddle.net/pq62hx0t/4/
View a.js
 function matrixArrayToCssMatrix(array) { return "matrix3d(" + array.join(',') + ")"; } function multiplyMatrixAndPoint(matrix, point) { //Give a simple variable name to each part of the matrix, a column and row number var c0r0 = matrix[0], c1r0 = matrix[1], c2r0 = matrix[2],
Last active Nov 7, 2020
View _final.md

# 先說結論

• 面試時別急著跳進去回答問題，先拉高層次觀察問題的形狀，搞清楚 root cause 後再思考答案與解法

• 過程中多詢問主考官真正想達到的目地、目前為何採取此手法、現在的做法是否遇到困難、有無解法上的限制(time, mem, cpu bound)

Last active Aug 9, 2020
Toggle vi_mode mode with caps_lock so that hjkl keys function as arrow keys and u/i as delete and backspace.
View karabiner.json
 { "global": { "check_for_updates_on_startup": true, "show_in_menu_bar": false, "show_profile_name_in_menu_bar": false }, "profiles": [ {
Created May 27, 2020
View gpx.js
 { id: 'Root', initial: 'after map loaded', states: { 'before map loaded': { on: {}, states: {} }, 'after map loaded': { on: {},
Last active Apr 13, 2021
Extensive research of statecharts with a focus on front-end development.
View statechart-xstate.md

# The case for statechart and xstate -- why it matters and how we can benefit from it

## Bottom line up front

• redux is a global `data` management tool, not a proper `state` management tool, hence causing a lot of troubles

• statecharts is an extension to Finite State Machine (FSM) which provides explicit and safe state management capabilities, perfectly fit for front-end development

• statecharts had been used intensivelly in all industries (be it embedded systems, hardware, electronics, aeronautics, automotive, game development and more), it's us front-end developers late to the party

Last active Aug 30, 2019
Generated by XState Viz: https://xstate.js.org/viz
View machine.js
 // Available variables: // - Machine // - interpret // - assign // - send // - sendParent // - spawn // - raise // - actions
Created Aug 29, 2019
[Request for comment] Is there any potential issues handling componentDidMount and componentDidUp with useHooks in this manner?
View useEffect.js
 const once = useRef(false) useEffect(() => { if(once.current === false){ once.current = true // do things as were in componentDidMount return }