Skip to content

Instantly share code, notes, and snippets.

@hitsujiwool
hitsujiwool / docker.json
Created September 15, 2015 06:20
docker + docker-compose on Amazon Linux
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
"aws_secret_key": "{{env `AWS_SECRET_KEY`}}"
},
"builders": [
{
"type": "amazon-ebs",
"ssh_pty": true,
"access_key": "{{user `aws_access_key`}}",
@hitsujiwool
hitsujiwool / Application.scala
Last active August 29, 2015 14:02
WebSocket on Play2.3
package controllers
import play.api.libs.iteratee._
import play.api.mvc._
import play.api.libs.concurrent.Execution.Implicits._
object Application extends Controller {
def ws = WebSocket.using[String] { request =>
val (out, channel) = Concurrent.broadcast[String]
#!/bin/bash
#
# NAME
# gitcmp
#
# SYNOPSIS
# gitcmp dir [branch-name]
#
# DESCRIPTION
# Check if the local head and the remote head refers to the same commit revision.
var sinon = require('sinon');
var assert = require('assert');
function async(cb) {
setTimeout(function() {
cb();
}, 1000);
}
describe('async()', function() {
function* fib() {
var i = 0,
j = 1,
res;
while (true) {
res = i + j;
i = j;
j = res;
yield res;
@hitsujiwool
hitsujiwool / changes_on_common_modules.md
Last active December 31, 2015 01:09
Developer Guide for Term Suite Japanese Component

Some addition and modification were done to files other than Japanese components which is placed under japanese directory. Althrough not tested comprehensively in all the languages, these changes have hardly any (negative) side effects on the other language components.

build.gradle

  • Added remote maven repository of my own hosted on GitHub for Japanese component. As this is only for my own convenience, it may be better to clone them and start to manage it on the term-suite repository.

  • Specified the directory for unit testing (under ttc-term-suite/tests/).

eu.project.ttc.resources.SimpleTermFrequency

function App() {
this.specAndMessages = [];
};
App.prototype.addSpecAndMessage = function(spec, message) {
this.specAndMessages.push({
spec: spec,
message: message
});
};
@hitsujiwool
hitsujiwool / hello.js
Created December 2, 2012 16:01 — forked from shigeki/hello.js
第1回Node.js入門勉強会 レポート課題
var http = require('http');
server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
server.close();
});
server.listen(8080, 0, function () {
console.log('Server running at http://localhost:8080/');
});
@hitsujiwool
hitsujiwool / phrase-extract.js
Created September 27, 2012 04:30
Phrase Extraction
/**
* Phrase Extraction
*/
;(function(exports) {
function extractPhrases(e, f, a) {
var fStart,
fEnd,
result = [];
@hitsujiwool
hitsujiwool / csssprite.rb
Created September 16, 2012 07:37
CSS Sprite Generator
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#
# CSS Sprite Generator
# require imagemagick
# require Ruby >= 1.9
# Usage:
# ruby csssprite.rb file1 file2 file3 [options]
# Options: