Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am kamimoo on github.
  • I am kamimoo (https://keybase.io/kamimoo) on keybase.
  • I have a public key ASDhKaLbtiJHSNmJYoLmrtImdqffSe0FwuqhCBiOd9QejAo

To claim this, I am signing this object:

htmlParser = require('htmlparser2')
result = ''
selfClosingTags = ['img', 'br', 'hr']
parser = new htmlParser.Parser(
onopentag: (name, attribs) =>
result += "<#{name}"
for attr, val of attribs
if val.length
@kamimoo
kamimoo / post-merge
Last active August 29, 2015 14:23 — forked from sindresorhus/post-merge
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
if [ -x "`which -s npm`" ]; then
echo "node is not installed"
exit 1
fi
cd "$(dirname ${BASH_SOURCE[0]})/../.."
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
@kamimoo
kamimoo / NSString+Replacement.m
Created November 21, 2014 04:04
JSのString.prototype.replace()で関数を渡すのと同等の処理
- (NSString *)stringByReplacingPattern:(NSString *)patternString usingBlock:(NSString *(^)(NSTextCheckingResult *match))replacer {
if (!replacer) {
return nil;
}
NSRegularExpression *regex = [NSRegularExpression
regularExpressionWithPattern:patternString
options:NSRegularExpressionAnchorsMatchLines
error:NULL];