Skip to content

Instantly share code, notes, and snippets.

View heypoom's full-sized avatar
🏠
Working from home

Phoomparin Mano heypoom

🏠
Working from home
View GitHub Profile

command + option + esc = force quit command + , = preferences command + w = close window option + command + w = close all window command + l = address bar command + `- = switch between windows command + shift + t = open previously closed tabs command + ; = spelling control + command + D = dictionary lookup option + delete = delete word

@heypoom
heypoom / fix-encoding.js
Last active January 2, 2019 08:04
Fixes the incorrect latin-1 encoding for Thai JSON files. Put in ~/bin/fix-json-encoding
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
function traverse(o, func) {
for (let i in o) {
o[i] = func(i, o[i])
if (o[i] && typeof o[i] == 'object') {
{
"parser": "babel-eslint",
"extends": [
"standard",
"plugin:react/recommended",
"prettier",
"prettier/react",
"prettier/standard"
],
"plugins": ["react", "prettier", "standard"],

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

const createElement = React.createElement
React.createElement = (element, props, children, ...args) => {
// Fancy Logging for React Element Creation
const _props = props ? Object.entries(props).map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(' ') : ''
console.log(`Creating %c<${element} %c${_props} %c/>`, 'color: teal; font-weight: bold', 'color: #777', 'color: teal')
// TODO: Monkey Patch your code here.
return createElement(element, props, children, ...args)
macro_rules! greet {
($name:expr) => {
println!("Greetings, {}!", $name);
};
}
fn main() {
greet!("Phoom")
}
macro_rules! hey {
() => {
println!("Hey, Macros!");
};
}
fn main() {
hey!()
}
use std::collections::HashMap;
macro_rules! mapping {
( $key:expr => $value:expr ) => {{
let mut m = HashMap::new();
m.insert($key, $value);
m
}};
}
macro_rules! mapping {
( $($key:expr => $value:expr),* ) => {
{
let mut m = HashMap::new();
$(
m.insert($key, $value);
)*
m