Skip to content

Instantly share code, notes, and snippets.

View shinnya's full-sized avatar

foobar shinnya

  • Japan
View GitHub Profile
@olifante
olifante / gist:222879
Created October 31, 2009 01:46
Interview with Joe Armstrong & Simon Peyton Jones

extracted from http://www.infoq.com/interviews/armstrong-peyton-jones-erlang-haskell

I'm Sadek Drobi. I'm here at Erlang Factory with Simon Peyton Jones and Joe Armstrong. Can you please tell us about yourselves and what you've been busy with lately?

JA: I'm Joe Armstrong and I'm at Erlang Factory. I've just been to a very nice talk where Simon has told us about the birth of Haskell and Erlang and how they point along parallel routes solving the same problems. I think we can talk a bit about that, because in your lecture you said things about "We tried that

@nathansmith
nathansmith / module_pattern_init.js
Created January 11, 2010 17:08
Init + Module Pattern JS
// JS Module Pattern:
// http://j.mp/module-pattern
// Redefine: $, window, document, undefined.
var APP = (function($, window, document, undefined) {
// Automatically calls all functions in APP.init
$(document).ready(function() {
APP.go();
});
@oxbowlakes
oxbowlakes / 3nightclubs.scala
Created May 13, 2011 15:14
A Tale of 3 Nightclubs
/**
* Part Zero : 10:15 Saturday Night
*
* (In which we will see how to let the type system help you handle failure)...
*
* First let's define a domain. (All the following requires scala 2.9.x and scalaz 6.0)
*/
import scalaz._
import Scalaz._
@stympy
stympy / excerpt.rb
Created May 23, 2011 13:14
Jekyll excerpt plugin
# This goes in _plugins/excerpt.rb
module Jekyll
class Post
alias_method :original_to_liquid, :to_liquid
def to_liquid
original_to_liquid.deep_merge({
'excerpt' => content.match('<!--more-->') ? content.split('<!--more-->').first : nil
})
end
end
@rowan-m
rowan-m / gist:1026918
Created June 15, 2011 11:34 — forked from jedi4ever/gist:898114
update jenkins Updatecenter from CLI
$ java -jar jenkins-cli.jar -s http://localhost:9000 install-plugin findbugs
findbugs is neither a valid file, URL, nor a plugin artifact name in the update center
No update center data is retrieved yet from: http://updates.jenkins-ci.org/update-center.json
findbugs looks like a short plugin name. Did you mean 'null'?
# Specifying a full URL works!
$ java -jar jenkins-cli.jar -s http://localhost:9020 install-plugin http://updates.jenkins-ci.org/download/plugins/AdaptivePlugin/0.1/AdaptivePlugin.hpi
# Get the update center ourself
@tily
tily / scaling_isomorphic_javascript_code.ja.markdown
Last active May 1, 2023 09:03
サバクラ両方で動く JavaScript の大規模開発を行うために

サバクラ両方で動く JavaScript の大規模開発を行うために

原文:Scaling Isomorphic Javascript Code (This is just for study, please contact me at tily05 atmark gmail.com if any problem.)

考えてみれば Model-View-Controller とか MVC ってよく聞くよね。実際どんなものか知ってる? 抽象的に言うなら「オブジェクト情報の保持されるグラフィック・システム (つまり、ラスターではないグラフィック。ゲームとか) 上に構築された、表示系を中心としたアプリケーションにおいて、主要な機能どうしの関わりをうまく分離すること」とでも言おうか。もう少し深く考えを押し進めてみれば、これは当然、他のさまざまなアプリケーションにもあてはまる言葉 (bucket term ?) だ。

過去に多くの開発コミュニティが MVC による解決案を提供し、それによってよくあるユースケースにうまく対処し、地位を築くことができた。例をあげるなら、Ruby や Python コミュニティは Rails や Django を作り、MVC アーキテクチャを実現した。

@bsodmike
bsodmike / gist:1369419
Created November 16, 2011 06:25
Subdomain Routing with Rails 3.1

Implement Routing for Subdomains

Rails 3.0 introduced support for routing constrained by subdomains.

A subdomain can be specified explicitly, like this:

match '/' => 'home#index', :constraints => { :subdomain => 'www' } 
@do-aki
do-aki / session.c
Created December 6, 2011 02:24
PHP 5.4.0RC2 ext/session/session.c
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2011 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
@ngocdaothanh
ngocdaothanh / Benchmark.scala
Created December 17, 2011 14:00
ByteBuffer.allocateDirect vs Unsafe
object Benchmark {
private val LOOP_COUNT = 1000000
private val ARRAY_SIZE = 1024
def main(args: Array[String]) {
val t1 = System.currentTimeMillis
var i = 0
while (i < LOOP_COUNT) {
testDirectByteBuffer
@mumoshu
mumoshu / play1_style_session_id_and_expiration.scala
Created March 22, 2012 18:18
Play 2.0でPlay 1.x風のセッションID払い出し、有効期限管理をする
def ActionUsingSession(f: => PlainResult): Action[AnyContent] = {
ActionUsingSession { request => f }
}
def ActionUsingSession(f: Request[AnyContent] => PlainResult): Action[AnyContent] = {
ActionUsingSession[AnyContent](parse.anyContent)(f)
}
def ActionUsingSession[A](bp: BodyParser[A])(f: Request[A] => PlainResult): Action[A] = {
Action(bp) { request: Request[A] =>