This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
npm --version | |
npm install | |
$(npm bin)/eslint --version | |
$(npm bin)/eslint --fix $(git ls-files | grep -v vendor | grep "js[x]*$") || true | |
git diff --exit-code && exit 0 | |
git add . | |
timestamp=`date +'%Y%m%d%H%M'` | |
commit_comment="eslint --fix $timestamp" | |
git commit -m "$commit_comment" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Taken from http://thinca.hatenablog.com/entry/20150306/1425639218 | |
while read local_ref local_sha1 remote_ref remote_sha1 | |
do | |
if [[ "${remote_ref##refs/heads/}" = "master" ]]; then | |
echo "Do not push to master branch!!!" | |
exit 1 | |
fi | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bundle exec rubocop --auto-correct $(git ls-files | grep -E -v "^(db|bin)" | grep "\.rb$") || true | |
git diff --exit-code && exit 0 | |
git add . | |
timestamp=`date +'%Y%m%d%H%M'` | |
commit_comment="rubocop --auto-correct $timestamp" | |
git commit -m "$commit_comment" | |
git checkout -b rubocop-auto-correct-$timestamp | |
branch_name=`git name-rev --name-only HEAD` | |
git push -u origin $branch_name | |
hub pull-request -m "$commit_comment" -h proper-inc:$branch_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Running Wild - Death or Glory | |
Mobb Deep - The Infamous | |
Basic Channel - s/t | |
Carnage - Dark Recollections | |
Buffalo Springfield - Again | |
Os Mutantes - s/t | |
Bulldoze - The Final Beatdown | |
Archimedes Badkar - s/t | |
クラムボン - まちわび まちさび | |
Lip Cream - s/t |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fileToDataUrl = (file) => { | |
return new Promise((resolve, reject) => { | |
const reader = new FileReader | |
reader.onload = (e) => { | |
resolve(e.target.result) | |
}; | |
reader.readAsDataURL(file); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Posix.Signals | |
import Control.Concurrent | |
main :: IO () | |
main = do | |
m <- newEmptyMVar | |
installHandler sigKILL (Catch (putMVar m "Hi")) Nothing | |
installHandler keyboardSignal (Catch (putMVar m "Hi")) Nothing | |
takeMVar m >>= print |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def json_include x, y | |
case x | |
when Hash | |
return false unless y.is_a? Hash | |
y.all? { |k, v| json_include(x[k], v) } | |
when Array | |
return false unless y.is_a? Array | |
y.all? { |y_| x.any? { |x_| json_include(x_, y_) } } | |
else | |
x == y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Client | |
def initialize | |
@all_entries = [*1..30].map { |i| "Hello this is #{i}" } | |
end | |
def get(option) | |
from = option[:from_id] || 0 | |
@all_entries[from..(from + 5)] | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
set -x | |
# If there are whitespace errors, print the offending file names and fail. | |
git diff-index --check --cached HEAD | |
exec git diff --cached --name-only --diff-filter=AM | grep '\.rb$' | xargs rubocop |