Skip to content

Instantly share code, notes, and snippets.

View monzou's full-sized avatar

Takuro Monji monzou

  • Tokyo
View GitHub Profile
import Control.Applicative
-- fmap : (a -> b) -> f a -> f b
-- fmap は関数とファクター値を引数にとって, 関数をファンクター値の中の値に適用
class Functor f where
fmap :: (a -> b) -> f a -> f b
-- <*> : f (a -> b) -> f a -> f b (f is Fanctor)
-- <*> は関数の入っているファンクター値と値の入っているファンクター値を引数にとって, ひとつ目のファンクターの中身の関数をふたつ目のファンクターの中身に適用
@tbranyen
tbranyen / backbone.collectioncache.js
Created June 4, 2012 06:37
Backbone.Collection caching by URL
/*!
* backbone.collectioncache.js v0.0.2
* Copyright 2012, Tim Branyen (@tbranyen)
* backbone.collectioncache.js may be freely distributed under the MIT license.
*/
(function(window) {
"use strict";
// Dependencies
@yarinb
yarinb / ServerFactory.java
Created June 1, 2012 08:11
add SessionManager to Dropwizard's Jetty
private Handler createExternalServlet(ImmutableMap<String, ServletHolder> servlets,
ImmutableMultimap<String, FilterHolder> filters,
ImmutableSet<EventListener> listeners) {
// set ServletContextHandler.SESSIONS option
final ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.SESSIONS);
// set a default SessionHandler
handler.setSessionHandler(new SessionHandler());
handler.addFilter(ThreadNameFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
handler.setBaseResource(Resource.newClassPathResource("."));
@taichi
taichi / code_reading.md
Last active April 10, 2024 13:04
太一のコードの読み方メモ

太一のコードの読み方メモ

全体として太一が感覚的に実践している事を論理的に説明しようと試みている為、
説明の粒度が適切でなかったり一貫性が無いように見える部分があるかもしれない。
普段やっているけども書ききれていない事も多分きっとある。

コードを読むとは何か

  • コードを嗜む
  • コードを学ぶ
  • 武器を手に入れる
@matope
matope / NoSQLデータモデリング技法.markdown
Created April 16, 2012 03:35
NoSQLデータモデリング技法

#NoSQLデータモデリング技法

原文:NoSQL Data Modeling Techniques « Highly Scalable Blog

I translated this article for study. contact matope[dot]ono[gmail] if any problem.

NoSQLデータベースはスケーラビリティ、パフォーマンス、一貫性といった様々な非機能要件から比較される。NoSQLのこの側面は実践と理論の両面からよく研究されている。ある種の非機能特性はNoSQLを利用する主な動機であり、NoSQLシステムによく適用されるCAP定理がそうであるように分散システムの基本的原則だからだ。一方で、NoSQLデータモデリングはあまり研究されておらず、リレーショナルデータベースに見られるようなシステマティックな理論に欠けている。本稿で、私はデータモデリングの視点からのNoSQLシステムファミリーの短い比較といくつかの共通するモデリングテクニックの要約を解説したい。

本稿をレビューして文法を清書してくれたDaniel Kirkdorfferに感謝したいと思う

@aolshevskiy
aolshevskiy / build.gradle
Created January 16, 2012 03:14
Multiple webapp resource dirs with Gradle-embed Jetty
import org.gradle.api.plugins.jetty.internal.JettyPluginWebAppContext
apply plugin: "jetty"
def newResourceCollection(File... resources) {
shell = new GroovyShell(JettyPluginWebAppContext.class.classLoader)
shell.setProperty("resources", resources as String[])
return shell.evaluate(file("resource_collection.groovy"))
}
@jdewind
jdewind / EventBusOnGuiceRoids.java
Created January 13, 2012 14:59
EventBus on GuiceRoids
public class ApplicationModule extends AbstractModule {
private final EventBus eventBus = new EventBus("Default EventBus");
@Override
protected void configure() {
bind(EventBus.class).toInstance(eventBus);
bindListener(Matchers.any(), new TypeListener() {
public <I> void hear(TypeLiteral<I> typeLiteral, TypeEncounter<I> typeEncounter) {
typeEncounter.register(new InjectionListener<I>() {
public void afterInjection(I i) {
@rummelonp
rummelonp / jquery-ujs.sample.md
Created December 13, 2011 02:25
jquery-ujs.js(rails.js)便利だよって話

jquery-ujs.js(rails.js)便利だよって話

自前でやる場合

JavaScript でクリックのイベント処理とか GET 以外ならトークンを含めるとか全部やらないといけないから面倒くさい

HTML

<a href="/some_action" class="some-action">some action</a>
@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 アーキテクチャを実現した。

@ralph
ralph / github-flavored-markdown.rb
Created October 20, 2011 11:39
Markdown Processor for Redcarpet version 2, for usage on the command line, in Marked etc. Supports syntax highlighting via Pygments.
#!/usr/bin/env ruby
# Processor for Github flavored markdown, inspired by:
# https://github.com/alampros/Docter/blob/master/bin/github-flavored-markdown.rb
#
# Current version of this script can be found here:
# https://gist.github.com/1300939
#
# Adapted for Redcarpet version 2 by Ralph von der Heyden
# http://github.com/ralph
# http://twitter.com/ralph