Skip to content

Instantly share code, notes, and snippets.

View nownabe's full-sized avatar
💪
Yeah!!

Shogo Watanabe nownabe

💪
Yeah!!
View GitHub Profile
@nownabe
nownabe / clustering.rb
Created December 13, 2016 06:51
ruby-mecab-kmeans
require "kmeans-clusterer"
require "natto"
class WordDic
class << self
def [](word)
dictionary[word] ||= next_index
end
def size
@nownabe
nownabe / base64.html
Last active June 5, 2017 09:19
JavaScript Base64 Encoding Performance
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Base64 Encoding Performance</title>
</head>
<body>
<p id="counter"></p>
<input type="file" id="dialog" multiple>
@nownabe
nownabe / deploy
Last active June 27, 2017 15:01
Deploy GitHub Pages
#!/bin/bash
set -eux
cd out # deploy directory
git init .
git config --local user.name USER
git config --local user.email [email protected]
git checkout -b gh-pages
@nownabe
nownabe / test_gem.rb
Created September 1, 2017 11:44
Ruby Hack Challenge
# Usage:
# $ make
# $ make install
# $ ./ruby test_gem.rb test GEM_NAME
require "rbconfig"
require "rubygems"
require "rubygems/gem_runner"
require "rubygems/exceptions"
require "yaml"
@nownabe
nownabe / mkmf.patch
Created September 10, 2017 13:06
test-gems
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 7e40c2d..a6299a0 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -6,6 +6,61 @@
require 'rbconfig'
require 'fileutils'
require 'shellwords'
+require "pp"
+require "open3"
@nownabe
nownabe / test_gems.sh
Last active September 24, 2017 01:39
GemTester Script
#!/bin/bash
function install_build_dependencies_ubuntu() {
sudo apt-get install -y \
git ruby autoconf bison gcc make zlib1g-dev libffi-dev \
libreadline-dev libgdbm-dev libssl-dev
}
function install_test_dependencies_ubuntu() {
sudo apt-get install -y \
@nownabe
nownabe / .commit_template
Last active January 24, 2018 08:34
Emoji Commit Prefix
# ==== Emojis ====
# 🌟 :sparkles: Adds a new feature or updates an existing feature
# 🐛 :bug: Fixes a bug
# ⚡ :zap: Improves performance of a feature
# 🔒 :lock: Fixes a security issue
# 🚿 :shower: Refactors an existing feature
# 👕 :tshirt: Fixes a code style violation
# 🔥 :fire: Deletes useless features, codes or files
# 📝 :pencil: Adds or updates a documentation
# 👮 :cop: Adds missing tests or correcs existing tests
@nownabe
nownabe / pre-commit
Created January 11, 2018 01:34
Go pre-commit
#!/bin/bash
gofiles=$(git diff --cached --name-only --diff-filter=ACM | grep '\.go$')
[[ -z "${gofiles}" ]] && exit 0
make pre-commit
@nownabe
nownabe / main.go
Created March 13, 2018 01:03
Go map memory
package main
import (
"fmt"
"runtime"
"golang.org/x/text/language"
"golang.org/x/text/message"
)
@nownabe
nownabe / rename.rb
Last active March 23, 2018 03:59
Renamer
# frozen_string_literal: true
require "color_echo"
patterns = {
/oldname/ => "newname",
}
skip_files = [
/^\.git\//,