Skip to content

Instantly share code, notes, and snippets.

View vincivince's full-sized avatar

Vincent Desbarres vincivince

View GitHub Profile
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@vincivince
vincivince / machine.js
Last active June 26, 2020 18:50
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
Machine({
id: 'SWAPI',
initial: 'idle',
context: {
user: null
},
states: {
idle: {
on: {
FETCH: 'loading'
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@vincivince
vincivince / code1.js
Created January 18, 2020 14:44 — forked from chrisrzhou/code1.js
React Hooks + Threejs
function useResponsiveCanvas<T>(
initialSize?: MinMaxPair,
): State {
const canvasRef = useRef<HTMLCanvasElement>();
const mountRef = useRef<HTMLDivElement>();
const [size, setSize] = useState<MinMaxPair>([0, 0]);
// set initial svg and size
useEffect(() => {
const canvas = document.createElement('canvas');
@vincivince
vincivince / thinced.js
Created August 27, 2018 23:32 — forked from varmais/thinced.js
Geolocation to Promise wrap example
var getPosition = function (options) {
return new Promise(function (resolve, reject) {
navigator.geolocation.getCurrentPosition(resolve, reject, options);
});
}
getPosition()
.then((position) => {
console.log(position);
})
@vincivince
vincivince / wget
Last active August 2, 2018 12:30
WGET
wget -p -k http://youru.rl
@vincivince
vincivince / sublimeosx
Created February 28, 2014 23:10
Sublime OSX Terminal support
ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime