Skip to content

Instantly share code, notes, and snippets.

@itiut
itiut / main.go
Last active November 8, 2017 16:23
`encoding/csv` reads UTF-8 BOM.
package main
import (
"encoding/csv"
"fmt"
"log"
"os"
)
func main() {
@itiut
itiut / Makefile
Last active August 17, 2017 03:47
A simple Makefile for unit testing with Criterion
## Constants
CC := gcc
CFLAGS := -Wall -O2 -MMD -MP
## Variables
program := main
test-program := test-main
#!/usr/bin/env bash
ghq list -p | while read dir; do
{
cd $dir
if git rev-parse --is-inside-work-tree &> /dev/null; then
echo "$PWD (git:$(git rev-parse --abbrev-ref HEAD))"
else
echo $PWD
fi
--- smilesData.js 2016-12-09 22:21:24.000000000 +0900
+++ smilesData-after.js 2016-12-10 16:51:46.000000000 +0900
@@ -600,7 +600,7 @@
1F49D HEART WITH RIBBON
1F49E REVOLVING HEARTS
1F49F HEART DECORATION
-1F4A0 DIAMOND SHAPE WITH DOT INSIDE
+1F4A0 DIAMOND SHAPE WITH A DOT INSIDE
1F4A1 ELECTRIC LIGHT BULB
1F4A2 ANGER SYMBOL
@itiut
itiut / markdown-it-emoji-v1.3.0-to-md.js
Last active December 10, 2016 06:13
Render markdown-it-emoji v1.3.0 keys in full.json
// usage: node ./markdown-it-emoji-v1.3.0-to-md.js > markdown-it-emoji-v1.3.0.md
const data = require('markdown-it-emoji/lib/data/full.json');
console.log('| # | key | rendered |');
console.log('|----:|----|----|')
for (const [i, key] of Object.keys(data).entries()) {
console.log(`| ${i} | \`:${key}:\` | :${key}: |`);
}
@itiut
itiut / emoji-datasource-v2.4.4-to-md.js
Last active December 10, 2016 06:10
Render emoji-datasource v2.4.4 `.short_name`s
// usage: node ./emoji-datasource-v2.4.4-to-md.js > emoji-datasource-v2.4.4.md
const data = require('emoji-datasource');
console.log('| # | short_name | rendered |');
console.log('|----:|----|----|');
for (const [i, emoji] of data.entries()) {
const shortName = `:${emoji.short_name}:`;
console.log(`| ${i} | \`${shortName}\` | ${shortName} |`);
}
@itiut
itiut / gen-mit-license
Last active December 6, 2016 05:18
Generate a MIT License file named LICENSE.md
#!/bin/sh -eu
curl -s -H 'Accept:application/vnd.github.drax-preview+json' https://api.github.com/licenses/mit \
| jq -j '.body' \
| sed "s/\[year\]/$(date +%Y)/;s/\[fullname\]/$(git config --get user.name)/" \
> LICENSE.md
@itiut
itiut / .zshenv
Created November 24, 2016 03:28
Profile zsh startup scripts on microsecond scale
# Beginning of ~/.zshenv
PS4=$'%D{%s%6.}\011%N:%i> '
exec 3>&2 2> ~/tmp/zsh/zshstartup.$$.log
setopt xtrace
# ...
@itiut
itiut / _aws
Last active November 22, 2016 06:02
Autoload zsh completion for aws-cli installed by Homebrew
#compdef aws
if [ -e /usr/local/share/zsh/site-functions/_aws ]; then
source /usr/local/share/zsh/site-functions/_aws
fi
_aws() {
:
}
diff --git a/Users/itiut/src/github.com/spree-contrib/spree_i18n/config/locales/ja.yml b/Users/itiut/src/github.com/honkimi/SpreeJa/config/locales/ja.yml
index 563f476..35e9e4d 100644
--- a/Users/itiut/src/github.com/spree-contrib/spree_i18n/config/locales/ja.yml
+++ b/Users/itiut/src/github.com/honkimi/SpreeJa/config/locales/ja.yml
@@ -12,11 +12,11 @@ ja:
state: "都道府県(州)"
zipcode: "郵便番号"
spree/calculator/tiered_flat_rate:
- preferred_base_amount:
- preferred_tiers: