Skip to content

Instantly share code, notes, and snippets.

View shirohana's full-sized avatar

Hana Shiro shirohana

View GitHub Profile
@shirohana
shirohana / ~hooks-use-navigate-lock.js
Last active February 15, 2020 09:03
React Navigation Lock Example
// @flow
import { useCallback, useState } from 'react'
import { useFocusEffect } from '@react-navigation/native'
export default function useNavigateLock () {
const [isLocked, setIsLocked] = useState(false)
useFocusEffect(useCallback(() => {
setIsLocked(false)
}, []))
@shirohana
shirohana / ioslocaleidentifiers.csv
Last active March 7, 2019 05:23 — forked from suraphanL/ioslocaleidentifiers.csv
iOS Locale Identifiers
localeIdentifier Description
af Afrikaans
af-NA Afrikaans (Namibia)
af-ZA Afrikaans (South Africa)
agq Aghem
agq-CM Aghem (Cameroon)
ak Akan
ak-GH Akan (Ghana)
am Amharic
am-ET Amharic (Ethiopia)
@shirohana
shirohana / ioscountrycodes.csv
Last active March 7, 2019 04:33 — forked from jacobbubu/ISOCountryCodes.csv
iOS Country Codes
CountryCode Description
AD Andorra
AE United Arab Emirates
AF Afghanistan
AG Antigua and Barbuda
AI Anguilla
AL Albania
AM Armenia
AN Netherlands Antilles
AO Angola
@shirohana
shirohana / Makefile
Created December 10, 2018 07:03
zx
.PHONY = inc
COUNTER_FILE = COUNTER
SOURCE_COUNTER = if [[ ! -e $(COUNTER_FILE) ]]; then touch $(COUNTER_FILE); fi; set -a; source $(COUNTER_FILE);
inc:
@$(SOURCE_COUNTER) \
echo $$COUNTER; \
echo 'export COUNTER='$$((COUNTER + 1)) > $(COUNTER_FILE)
@shirohana
shirohana / test.js
Created October 27, 2017 12:43
[Javascript] Traps when destructuring with getter
/**
* According to the example, we can know that Object-Destructuring
* has a left-to-right order (doesn't checked is it related to
* transpiler or is standard).
*/
class Test {
get prop1 () {
this._prop2 = 'prop2'
return (this._prop1 = 'prop1')
@shirohana
shirohana / .gitconfig
Last active November 5, 2017 10:05
Hana's git config
[alias]
lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
lga = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
range = show --oneline --quiet
tracked = ls-files --stage
untracked = ls-files --exclude-standard --others
ignored = ls-files --ignored --exclude-standard --others
conflicts = diff --name-only --diff-filter=U
@shirohana
shirohana / yarn-drop-cache.sh
Last active April 5, 2017 18:27
Simple shell script to drop the specified yarn cache
#!/bin/bash
REMOVE_DIRS=$(ls -d $(yarn cache dir)/* | grep $@)
if [ -z REMOVE_DIRS ]; then
echo Empty
else
for dir in $REMOVE_DIRS; do
read -p "rm -rf $dir? " -n 1 -r
echo # Present a newline
@shirohana
shirohana / git_config_alias.txt
Last active February 19, 2017 16:19
Hana's git aliases
[alias]
lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
lga = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
range = show --oneline --quiet
tracked = ls-files --stage
untracked = ls-files --exclude-standard --others
ignored = ls-files --ignored --exclude-standard --others
@shirohana
shirohana / tromino.cc
Created October 25, 2016 05:20
Tromino Puzzle Algorithm
#include <iostream>
#include <iomanip>
class Tromino {
public:
static int* Solve(int m, int block) {
int width = static_cast<int> (pow(2, m));
int *matrix = new int[width * width] {0};
n_ = 1;
@shirohana
shirohana / calc.md
Last active July 25, 2016 09:12
Simple calculator homework

簡易計算機練習

試製一符合題目要求之簡易計算機

  • 輸入符號為 + - * / ( )
  • 輸入數字皆為 實數
  • 製作包含括弧,考慮四則運算邏輯的計算機
  • 輸入皆為合法算式,無須考慮算式錯誤
  • 運算元之間皆以空格 作為切割
  • 運算元可為負數 (如: 1 * -3)