Skip to content

Instantly share code, notes, and snippets.

Kazuhito Hokamura hokaccha

Block or report user

Report or block hokaccha

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hokaccha
hokaccha / assert.js
Created Dec 5, 2011
node.js aseert for client side javascript
View assert.js
// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
//
// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
//
// Originally from narwhal.js (http://narwhaljs.org)
// Copyright (c) 2009 Thomas Robinson <280north.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the 'Software'), to
// deal in the Software without restriction, including without limitation the
View endtagcomment.vim
" こういうHTMLがあったときに
" <div id="hoge" class="fuga">
" ...
" </div>
"
" 実行するとこうなる
" <div id="hoge" class="fuga">
" ...
" <!-- /div#hoge.fuga --></div>
@hokaccha
hokaccha / sushi
Created Apr 30, 2014
Macのターミナルに寿司を降らせる
View sushi
$ ruby -e 'C=`stty size`.scan(/\d+/)[1].to_i;S="\xf0\x9f\x8d\xa3";a={};puts "\033[2J";loop{a[rand(C)]=0;a.each{|x,o|;a[x]+=1;print "\033[#{o};#{x}H \033[#{a[x]};#{x}H#{S} \033[0;0H"};$stdout.flush;sleep 0.01}'
View dispatcher.js
(function() {
function Dispatcher() {
this.routes = [];
}
Dispatcher.prototype.route = function route(path, action) {
this.routes.push({ path: path, action: action });
return this;
};
View app.js
import React from 'react';
import { Frame, FrameSet } from './react-flex-frame';
class App extends React.Component {
render() {
return (
<FrameSet direction="row">
<Frame width="300" resiable={true} className="side">
<h1>Side Bar</h1>
</Frame>
View .vimrc
" Capture {{{
command!
\ -nargs=1
\ -complete=command
\ Capture
\ call Capture(<f-args>)
function! Capture(cmd)
redir => result
silent execute a:cmd
View aho.rb
p AhoCorasick.new(["8年", "18年"]).match('平成18年') #=> ["18年"]
p AhoCorasick.new(["8年", "18年", "平成17年台風第11号"]).match('平成18年') #=> ["8年"]
View init.coffee
atom.commands.add 'atom-workspace', 'custom:set-cp932', ->
atom.workspace.getActiveTextEditor().setEncoding('cp932')
@hokaccha
hokaccha / git-export-diff
Created Sep 22, 2012
gitの差分のファイルをつくる
View git-export-diff
#!/bin/sh
set -e
if [ $# -ne 2 -a $# -ne 3 ]; then
echo 'Usage:'
echo ' $ git export-diff <commit> <output_dir>'
echo ' $ git export-diff <commit> <commit> <output_dir>'
exit 1
fi
You can’t perform that action at this time.