Skip to content

Instantly share code, notes, and snippets.

@jimmyhchan
jimmyhchan / appdef.js
Last active July 22, 2022 17:09
appdef to cytoscape
// replace `element` with what gets generated from here
// https://codesandbox.io/s/state-machine-visualizer-forked-vhky4h?file=/components/Graph.js
// original https://codesandbox.io/s/k000rnpnn7?file=/components/Graph.js
const objects = AppState.getAppDef().objects;
const elements = [];
// push leaves
Object.values(objects).forEach(o => {
// an edge
@jimmyhchan
jimmyhchan / .bashrc
Last active July 2, 2021 17:30
aliases for git
# HEY DO THIS
# ... add this to your .bash_profile
# if [ -f ~/.bashrc ]; then
# source ~/.bashrc
# fi
# bash completion
if [ -f /usr/local/etc/bash_completion ]; then
. /usr/local/etc/bash_completion
fi
@jimmyhchan
jimmyhchan / machine.js
Created September 23, 2020 23:15
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jimmyhchan
jimmyhchan / lets split build guide.md
Last active January 29, 2017 04:38 — forked from nicinabox/lets split build guide.md
This guide covers building a Let's Split v2.

An Overly Verbose Guide to Building a Let's Split Keyboard

This guide covers building a Let's Split v2. Order your parts and read over this guide while you wait.

  • I2C isn't covered in this guide (yet), mostly because I didn't do it for my build.
  • Flashing isn't covered. I'm hoping to add this to the QMK Let's Split readme instead.

Helpful references

@jimmyhchan
jimmyhchan / gist:8cd494cb0067e3edf3e9
Last active August 29, 2015 14:17
if else in function
function sayHello(name, lang) {
var greet;
if (lang === 'es') {
greet = 'hola';
} else {
greet = 'hello';
}
if (name) {
console.log(greet + ' ' + name);
alert()'
@jimmyhchan
jimmyhchan / intro.js
Last active January 2, 2016 13:19 — forked from seriousManual/intro.js
//whitespaces added for clarification
module.exports = (function(){
dust.register("intro",body_0);
function body_0(chk,ctx){
return chk.write("Hello ").reference(ctx._get(false, ["name"]),ctx,"h").write("!");
}
return body_0;
})();
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>LinkedIn Colleague Search</title>
<style type="text/css" media="screen">
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,