Skip to content

Instantly share code, notes, and snippets.

View hokaccha's full-sized avatar

Kazuhito Hokamura hokaccha

View GitHub Profile
@hokaccha
hokaccha / app.js
Created March 5, 2013 08:28
PRG test
var express = require('express');
var http = require('http');
var app = express();
app.get('/', function(req, res) {
res.send(
'<body>' +
'<form action="/a" method="POST">' +
'<input type="text" name="foo">' +
'<input type="submit">' +
@hokaccha
hokaccha / concern.rb
Created December 18, 2012 05:00 — forked from CodeIQ/concern.rb
# coding: utf-8
class Concern < ActiveRecord::Base
belongs_to :publication
end
Backbone.sync = function(method, model, options) {
var type = methodMap[method];
// Default options, unless specified.
options || (options = {});
// Default JSON-request options.
var params = {type: type, dataType: 'json'};
// Ensure that we have a URL.
var m = new Backbone.Model();
var View = Backbone.View.extend({
initialize: function() {
this.listenTo(this.model, 'change', this.render);
}
});
var v = new View({ model: m });
@hokaccha
hokaccha / backbone_0.9.2_3efc1ed_index.html.diff
Created December 14, 2012 03:49
`$ git diff 0.9.2..HEAD index.html`の結果
diff --git a/index.html b/index.html
index 581e230..b252a17 100644
--- a/index.html
+++ b/index.html
@@ -3,6 +3,8 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
+ <meta name="viewport" content="width=device-width">
+ <link rel="canonical" href="http://backbonejs.org" />
@hokaccha
hokaccha / answer.txt
Created November 22, 2012 02:44 — forked from shigeki/hello.js
第1回Node.js入門勉強会 レポート課題
**課題1
なぜエラーが発生したのかその理由を記述しなさい。
server.close()を呼ぶとこれ以上のコネクションは受け付けなくなるが、
既存のコネクションに関してはそのまま接続された状態になる。
また、HTTPの接続はkeep-aliveで行われるため、明示的にコネクションを
終了させなければ接続がタイムアウトするまでコネクションは生きている。
最初のリクエスト(GET /)のときにserver.close()が呼ばれ、新規接続を
function curry(fn, _this) {
return function(arg) {
return fn.bind(_this, arg);
}
}
function add(a, b, c) { return a + b + c }
var curried_add = curry(add);
$ npm -v
1.1.24
$ npm -g -p ll
/Users/hokamura/.nodebrew/current/lib::/Users/hokamura/.nodebrew/node/v0.6.19/lib
/Users/hokamura/.nodebrew/current/lib/node_modules/jshint:[email protected]:/Users/hokamura/.nodebrew/node/v0.6.19/lib/node_modules/jshint
/Users/hokamura/.nodebrew/current/lib/node_modules/jshint/node_modules/cli:[email protected]:/Users/hokamura/.nodebrew/node/v0.6.19/lib/node_modules/jshint/node_modules/cli
/Users/hokamura/.nodebrew/current/lib/node_modules/jshint/node_modules/cli/node_modules/glob:[email protected]:/Users/hokamura/.nodebrew/node/v0.6.19/lib/node_modules/jshint/node_modules/cli/node_modules/glob
/Users/hokamura/.nodebrew/current/lib/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/graceful-fs:[email protected]:/Users/hokamura/.nodebrew/node/v0.6.19/lib/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/graceful-fs
/Users/hokamura/.nodebrew/current/lib/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits:[email protected]:/Users/hokamura/.no
#!/usr/bin/env ruby
# https://gist.github.com/3957219
@cache = nil
def hoge
@cache ||= Proc.new {
fuga = piyo()
"result: #{fuga}"
@hokaccha
hokaccha / git-export-diff
Created September 22, 2012 02:14
gitの差分のファイルをつくる
#!/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