Skip to content

Instantly share code, notes, and snippets.

View markhker's full-sized avatar

Mark Hkr markhker

View GitHub Profile
@markhker
markhker / context.ts
Created June 11, 2021 00:32 — forked from bodokaiser/context.ts
React Hook integration for AWS Amplify Auth
import React from "react"
import { CognitoUser } from "@aws-amplify/auth"
import { useAuth } from "./hooks"
import { SignInInput } from "./types"
interface AuthState {
user: CognitoUser | null
signIn(input : SignInInput): Promise<void>
signOut(): Promise<void>
@markhker
markhker / 1.rreaddir.js
Created February 9, 2021 02:35 — forked from timoxley/1.rreaddir.js
async/await recursive fs readdir
import { join } from 'path'
import { readdir, stat } from 'fs-promise'
async function rreaddir (dir, allFiles = []) {
const files = (await readdir(dir)).map(f => join(dir, f))
allFiles.push(...files)
await Promise.all(files.map(async f => (
(await stat(f)).isDirectory() && rreaddir(f, allFiles)
)))
return allFiles
A
A + Certified
A-110
A-122
A-123
A-133
A-frames
A-GPS
A/B Testing
A/R analysis
@markhker
markhker / DefaultKeyBinding.dict
Created May 18, 2020 19:21 — forked from trusktr/DefaultKeyBinding.dict
My DefaultKeyBinding.dict for Mac OS X
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more
closely match default behavior on Windows systems. This makes the Command key
behave like Windows Control key. To use Control instead of Command, either swap
Control and Command in Apple->System Preferences->Keyboard->Modifier Keys...
or replace @ with ^ in this file.
Here is a rough cheatsheet for syntax.
Key Modifiers
@markhker
markhker / resolve-tsconfig-path-to-webpack-alias.js
Created March 12, 2020 17:37 — forked from nerdyman/resolve-tsconfig-path-to-webpack-alias.js
Convert TypeScript tsconfig paths to webpack alias paths
const { resolve } = require('path');
/**
* Resolve tsconfig.json paths to Webpack aliases
* @param {string} tsconfigPath - Path to tsconfig
* @param {string} webpackConfigBasePath - Path from tsconfig to Webpack config to create absolute aliases
* @return {object} - Webpack alias config
*/
function resolveTsconfigPathsToAlias({
tsconfigPath = './tsconfig.json',
@markhker
markhker / .gitmessage
Created September 7, 2018 20:24 — forked from RichardBronosky/.gitmessage
Use this Git commit message template to write better commit messages.
Replace this line with imperative summary
An awesome description of WHY you did this work, not HOW/WHAT it does.
The diff attached to commit should describe implementation (HOW)
well-enough.
# [TICKET-12]
#------------------------------------------------^---------------------^
# 50^ 72^
@markhker
markhker / add_two_times.js
Created November 9, 2017 22:42 — forked from joseluisq/add_two_times.js
Sum two times values HH:mm:ss with javascript
/**
* Sum two times values HH:mm:ss with javascript
* Usage:
* > addTimes('04:20:10', '21:15:10');
* > "25:35:20"
*
* @param {string} start
* @param {string} end
* @returns {String}
*/
@markhker
markhker / Enhance.js
Created August 23, 2017 16:39 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {

The apt-get version of node is incredibly old, and installing a new copy is a bit of a runaround.

So here's how you can use NVM to quickly get a fresh copy of Node on your new Bash on Windows install

$ touch ~/.bashrc
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
// restart bash
$ nvm install node
# Deploying NodeJS App on Google Cloud Platform
`authored Jul 3 2015 by kengz`
## Installation
- Account with Google Cloud Platform.
- Install [Google Cloud Platform SDK](https://cloud.google.com/sdk/) to use `cloud` in the terminal.
- Install [Docker](https://cloud.google.com/tutorials/install-docker) for the VM container.
- Locally, login for the first time: `gcloud auth login`