Skip to content

Instantly share code, notes, and snippets.

View X-Y's full-sized avatar

Xun Yang X-Y

  • Stockholm, Sweden
View GitHub Profile
@X-Y
X-Y / useUndoReducer.ts
Last active November 3, 2022 13:52 — forked from johanquiroga/useUndoReducer.js
Undo/Redo capability for any reducer using react hook `useReducer`
import { useReducer, Dispatch } from "react";
export enum USE_UNDO_REDUCER_TYPES {
undo = "UNDO",
redo = "REDO",
}
export type UndoRedoAction = {
type: USE_UNDO_REDUCER_TYPES;
};
export type HistoryType<T> = {
@X-Y
X-Y / Honeywell_Calibrate.ino
Created June 10, 2014 12:13
Calibrating Arduino Robot compass (old version, Honeywell HMC 6352)
#include <Wire.h>
#define ADDRESS 0x21
void setup(){
Wire.begin();
Serial.begin(9600);
while(!Serial);
calibrate();
}
@X-Y
X-Y / mittmollan.ino
Last active August 29, 2015 14:00
MittMollan
/*
*
* MittMollan
* Created by PirateCheese
* Modified and tested by X-Y
*
* Note: IR ranger is generating a lot noise for pot.
* No Calibration for LDR.
* Servo working, weird enough.
*
@X-Y
X-Y / GalileoSequencer.ino
Created December 10, 2013 21:13
Galileo Sequencer This sketch is used for a demo of the Intel Galileo board. When it was launched in Rome Maker fair 2013, we made a sequencer based on Galileo, SparkFun MP3 shield and the sketch ReadMP3fromSD originally created by Nathan Seidle.
/*
Galileo Sequencer
This sketch is used for a demo of the Intel Galileo board. When it was launched in Rome Maker fair 2013,
we made a sequencer based on Galileo, SparkFun MP3 shield and the sketch ReadMP3fromSD originally created
by Nathan Seidle.
The sequencer has 2 knobs, 4 buttons and 8 leds on its interface. When activated, it loops through and
plays 8 segments of sound samples repeatedly. At the mean time, the LEDs will light up according to which
segment you’re listening to. You can use the buttons and knobs to customize and add creativity into the sequence.