Skip to content

Instantly share code, notes, and snippets.

View hunterliu1003's full-sized avatar

Hunter Liu hunterliu1003

View GitHub Profile
@hunterliu1003
hunterliu1003 / getViewport.js
Created December 16, 2021 09:53
Viewport list from screensiz.es
function tableToJson($table) {
const $tds = $table.querySelectorAll("td");
const ths = [
"name",
"os",
"physicalSizeInch",
"physicalSizeCM",
"width",
"height",
@hunterliu1003
hunterliu1003 / delete_git_submodule.md
Created March 9, 2021 09:21 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@hunterliu1003
hunterliu1003 / cors.js
Created May 5, 2020 08:26 — forked from balupton/cors.js
Acheiving CORS via a Node HTTP Server
// Create our server
var server;
server = http.createServer(function(req,res){
// Set CORS headers
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Request-Method', '*');
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET');
res.setHeader('Access-Control-Allow-Headers', '*');
if ( req.method === 'OPTIONS' ) {
res.writeHead(200);
const infected = days => {
const INCUBATION_PERIOD_DAYS = 2
const INFECT_PEOPLE = 2
let infectedTotal = 1
const computed = (days, defaultInfectedPeop) =>
Array(days + 1)
.fill()
.reduce((total, cur, day) => {
if (day < INCUBATION_PERIOD_DAYS) {
@hunterliu1003
hunterliu1003 / README-Template.md
Created July 24, 2017 07:36 — 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