This file contains 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
module Match | |
def self.define_matchers!(m) | |
m.constants.each {|c| | |
eval "class #{c} < StandardError; end" | |
} | |
end | |
def self.match! obj | |
raise self.const_get(obj.class.to_s).new(obj) | |
end |
This file contains 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 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
@mixin stack-classes ($classes) { | |
$i: 10; | |
@each $class in $classes { | |
.#{$class} { | |
z-index: $i; | |
$i: $i + 10; | |
} | |
} | |
} |
This file contains 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 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 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 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 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 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
-- How to run | |
-- $ git log --numstat --pretty="%0" |grep -v "%0" | runhaskell sum.hs | |
import Control.Applicative | |
import Data.Map (Map) | |
import qualified Data.Map as Map | |
import System.IO | |
import Text.Read | |
import Data.List |