Skip to content

Instantly share code, notes, and snippets.

View shirohana's full-sized avatar

Hana Shiro shirohana

View GitHub Profile
class Test {
public static void main(String[] args) {
System.out.println("Test Gist!");
}
}
@shirohana
shirohana / ellipsis.css
Last active February 5, 2017 14:39
Bootstrap list-group in oneline with badge
.ellipsis {
display: -webkit-flex;
display: flex;
}
.ellipsis .ellipsis-item {
-webkit-flex: 1;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
@shirohana
shirohana / tioj_1004.cpp
Created January 3, 2016 10:05
TIOJ - problem 1004 - Use linked-list
// Problem source: http://tioj.infor.org/problems/1004
#include <iostream>
using namespace std;
typedef struct node {
int data;
node *next;
@shirohana
shirohana / calc.md
Last active July 25, 2016 09:12
Simple calculator homework

簡易計算機練習

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

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