Skip to content

Instantly share code, notes, and snippets.

View malcolm-kee's full-sized avatar

Malcolm Kee malcolm-kee

View GitHub Profile
@malcolm-kee
malcolm-kee / README-Template.md
Created July 6, 2023 06:00 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

tags
programming

Node.js Project Typescript Config

  1. Uninstall jest (this is due to some weird version resolution between jest and babel when jest is installed in advanced)

    npm uninstall jest @types/jest
@malcolm-kee
malcolm-kee / .bashrc
Created March 17, 2020 01:04
Bash config
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[0;42m\]\u@\h\[\033[0;46m\]>\w>\[\033[0m\]'
# PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
@malcolm-kee
malcolm-kee / focus-testing.js
Last active September 15, 2019 20:26
a11y util
document.body.addEventListener('focusin', (event) => {
console.log(document.activeElement)
})
@malcolm-kee
malcolm-kee / Defining.md
Last active September 11, 2019 10:51
Notes on JSON Schema

To define a schema you should always have type properties, which can be

  • "string"
  • "number" or "integer"
  • "object"
  • "array"
  • "boolean"
  • "null"

type can be a single string or an array of string.

/**
* Simple wrapper around XMLHttpRequest to make ajax request
* @param {string} url
* @param {Object} options
* @param {Function} [options.onSuccess]
* @param {Function} [options.onError]
* @param {string} [options.dataType] default to 'json'
* @param {string} [options.method] default to 'GET'
*/
function ajax(url, options) {
@malcolm-kee
malcolm-kee / settings.json
Created June 7, 2019 06:48
Presentation-Friendly VS Code Settings
{
"workbench.colorTheme": "GitHub Clean White",
"workbench.colorCustomizations": {
"editorCursor.background": "#ffffff",
"editorCursor.foreground": "#0000bb",
"editor.lineHighlightBackground": "#f0f0f0",
"editor.selectionBackground": "#aaeeff"
},
"workbench.statusBar.visible": false,
"workbench.activityBar.visible": false,
@malcolm-kee
malcolm-kee / javascript.json
Last active November 12, 2019 02:42
Javascript snippets
{
"Import react": {
"prefix": "imr",
"body": ["import React from 'react';"],
"description": "import react"
},
"React useState": {
"prefix": "rus",
"body": "const [$2, set${2/(^.)/${1:/upcase}/}] = React.useState(${1});"
},
@malcolm-kee
malcolm-kee / multi-cursor.html
Last active February 16, 2019 05:48
Multi Cursor Exercise
<!DOCTYPE html5>
<html>
<body>
<table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
</thead>
@malcolm-kee
malcolm-kee / join-string.js
Last active January 6, 2019 07:29
A common utility to generate string
export const joinString = (delimiter, ...params) => {
const results = [];
for (let param of params) {
if (!param) {
continue;
}
const paramType = typeof param;
if (paramType == 'string' || paramType == 'number') {