Skip to content

Instantly share code, notes, and snippets.

Avatar
I may be slow to respond.

Cheton Wu cheton

I may be slow to respond.
View GitHub Profile
View machine.js
const fetchMachine = Machine({
id: 'fetchMachine',
initial: 'idle',
context: {
isFetchedOnce: false,
isFetching: false,
data: null,
error: null,
},
states: {
View init.vim
" Convert new tabs to spaces
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
" No end of line
set noeol
call plug#begin()
@cheton
cheton / theme-preset.js
Last active Dec 27, 2019
(Draft) Trend Micro Frontend Theme
View theme-preset.js
const breakpoints = [
'320px',
'640px',
'1024px',
'1280px',
'1680px',
];
// @media screen and (min-width: 320px)
// @media screen and (min-width: 640px)
// @media screen and (min-width: 1024px)
View Carousel.jsx
@cheton
cheton / Parallelogram.jsx
Last active Nov 21, 2018
Parallelogram
View Parallelogram.jsx
import React from 'react';
import styled, { css } from 'styled-components';
const Component = styled.div`${({
width,
height,
before,
beforeBorderMask,
beforeBorderColor,
beforeBackgroundColor,
@cheton
cheton / expose-cards-timeout.js
Last active Aug 3, 2018
Expose Cards w/ Timeout
View expose-cards-timeout.js
require('babel-core/register');
require('babel-polyfill');
const timeout = (ms) => new Promise((resolve, reject) => {
setTimeout(() => reject(new Error(`Timeout exceeded: ${ms}ms`)), ms);
});
class Player {}
class AsyncAction {
View X-Carve GRBL-1.1f Settings.txt
# GRBL Source (The standard GRBL firmware is identaical to the Inventables GRBL, just some minor config changes.)
https://github.com/gnea/grbl
Compiled with settings:
[Changes to (config.h)]
#define DEFAULTS_X_CARVE_1000MM
#define HOMING_FORCE_SET_ORIGIN // Enabled
#define ENABLE_M7 // Enabled
#define ENABLE_SAFETY_DOOR_INPUT_PIN // Enabled
@cheton
cheton / particulate-matter.js
Last active Jul 3, 2018
A Particulate Matter Detector Using PM 2.5 Sensor by PLANTOWER
View particulate-matter.js
//
// http://aqicn.org/air/view/sensor/spec/pms7003.pdf
//
const SerialPort = require('serialport');
const port = new SerialPort('/dev/ttyUSB0', {
baudRate: 9600
});
@cheton
cheton / find-raspberry.sh
Created Jul 3, 2018 — forked from niun/find-raspberry.sh
Find Raspberry Pi in network (looking for MAC address vendor prefix of Raspberry Pi Foundation using nmap, awk for ipv4 / ping6, ip, grep for ipv6 neighbour discovery)
View find-raspberry.sh
sudo nmap -sP 192.168.0.0/24 | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}'