Skip to content

Instantly share code, notes, and snippets.

@joeynguyen
joeynguyen / AutoComplete.d.ts
Created August 29, 2022 05:59
AutoComplete TypeScript type
export type AutoComplete =
| "off"
| "on"
| "name"
| "honorific-prefix"
| "given-name"
| "additional-name"
| "family-name"
| "honorific-suffix"
| "nickname"
@joeynguyen
joeynguyen / Atreus2-Firmware.ino
Last active October 9, 2020 20:11
Atreus2: Proposal for a Keyboardio Model 01 style layout
/* -*- mode: c++ -*-
* Atreus -- Chrysalis-enabled Sketch for the Keyboardio Atreus
* Copyright (C) 2018, 2019 Keyboard.io, Inc
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
// -*- mode: c++ -*-
// Copyright 2016 Keyboardio, inc. <jesse@keyboard.io>
// See "LICENSE" for license details
#ifndef BUILD_INFORMATION
#define BUILD_INFORMATION "locally built"
#endif
/**
@joeynguyen
joeynguyen / Atreus2-Firmware.ino
Last active January 8, 2021 00:08
Joey's Keyboardio Atreus2 Firmware with modifiers on home row
/* -*- mode: c++ -*-
* Atreus -- Chrysalis-enabled Sketch for the Keyboardio Atreus
* Copyright (C) 2018, 2019 Keyboard.io, Inc
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@joeynguyen
joeynguyen / generators.md
Created March 30, 2020 19:24 — forked from learncodeacademy/generators.md
What are Javascript Generators?

##what are generators##

  • They're pausable functions, pausable iterable functions, to be more precise
  • They're defined with the *
  • every time you yield a value, the function pauses until .next(modifiedYieldValue) is called
var myGen = function*() {
  var one = yield 1;
  var two = yield 2;
  var three = yield 3;
 console.log(one, two, three);
@joeynguyen
joeynguyen / .Xmodmap
Created March 30, 2020 19:23
.Xmodmap for HHKB (Happy Hacking Keyboard)
! .Xmodmap
! HHKB emulator
! Fn
remove mod1 = Alt_R
keysym Alt_R = Mode_switch
add mod5 = Mode_switch
! arrows
keycode 34 = bracketleft braceleft Up NoSymbol
@joeynguyen
joeynguyen / isMomentPropType.js
Last active August 22, 2019 16:46
custom PropTypes validator for Moment object
import moment from 'moment'; // tested using v2.24.0
// custom PropType validator per example at
// https://github.com/facebook/prop-types/blob/v15.7.2/README.md#usage
export function isMomentPropType(props, propName, componentName) {
if (!moment.isMoment(props[propName])) {
return new Error(
`Invalid prop ${propName} supplied to ` +
`${componentName} is not a Moment object. Validation failed.`
);
@joeynguyen
joeynguyen / jsconfig.json
Last active January 29, 2019 21:28
Use Typescript to check JavaScript
// add this file to the root of your repo without these comment lines
// inside `compilerOptions`, include "moduleResolution": "node" if it's a Node project
// remove `jsx` lines if not using JSX
{
"compilerOptions": {
"target": "es2017",
"checkJs": true,
"jsx": "react"
},
"include": [
@joeynguyen
joeynguyen / launch.json
Created July 17, 2017 17:42
WebDriverIO/Cucumber.js - Example Visual Studio Code "Debugging" launch config
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"protocol": "legacy",
"port": 5859,
@joeynguyen
joeynguyen / launch.json
Created July 17, 2017 17:41
WebDriverIO/Cucumber.js Visual Studio Code "Debugging" launch config
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"protocol": "legacy",
"port": 5859,