Kengo's blog

Technical articles about original projects, JVM, Static Analysis and TypeScript.

javascript

JavaウェブアプリプロジェクトにJavaScript/TypeScriptなどの静的アセットをどう配置するか

以前のJavaウェブアプリ開発では、JavaScriptをはじめとした静的アセットはsrc/main/webappディレクトリに配置するのが普通だった。そこに置くことでmaven-war-pluginのようなビルドシステムが.warファイルの中に突っ込んでくれる。この挙動は今でも変わらな…

Read The Docs利用者用にPRレビュー支援Probotを作りました

私がSpotBugsなどで使っているドキュメントホスティングサービス、Read The Docsを使う上で助けになるGitHub Probotを作成しました。 github.com ドキュメントがいつもどおり全部英語なので、日本語での解説をここに書いておきます。 想定ユーザ Read The Do…

Mirror repositories for developer in China mainland

In China mainland, default repositories are not so useful because of bad network latency. Instead of them, we should use following mirrors for better productivity. Maven central 开源中国 Maven 库 gem RubyGems 镜像 - 淘宝网 npm 淘宝 NPM 镜像

When/How to use goog.ui.Component#makeId()

goog.ui.Component#makeId() is a helper function to generate ID for DOM elements. Let's start discussion based on sample component which contains following DOM: <form> <div> <input type="text"> </div> <button type="submit"> </form> To implement createDom() method, we may need to decide ID for each el…

goog.Promise の使い方

日本語情報少ないので。 Promiseとは? こちらをご覧ください。 JavaScript Promises: There and back again - HTML5 Rocks Promiseオブジェクトを作る newを使ってコンストラクタを呼ぶだけです。このとき、引数に関数をひとつ渡してやる必要があります。こ…

Tips to accelerate your original game

To make your game more interesting, you should pay much attention to keep high performance. This is UX problem, but it is not designer who can solve. Only developer has solution for this problem, so we should learn about when we face probl…

goog.ui.Componentの継承で気をつけるべきこと一覧

基本 Google Closure LinterとGoogle Closure Compilerを必ず使う コンポーネントツリーをシンプルに保つ(参考資料1 参照) インスタンスの状態 クラスフィールド(static変数)にインスタンスの状態を入れない。 インスタンスフィールドはprivateにする。 …

memo: JavaScript AST

Library http://esprima.org/ https://github.com/substack/node-burrito (not maintained) Blog (Japanese) 最小最速で作るaltjs - mizchi's blog カジュアルJavaScript AST 2012-10-29のJS: JavaScriptパーサ Esprima 1.0.0、Orion 1.0、大規模CoffeeScrip…

Closure Library でカタいクラスを実装する

ここではカタいクラス=フェイルファストで、コンパイル時に問題を発見しやすく、かつ保守しやすいクラス と定義する。 基本的には goog.ui.Component あたりを読むと勉強になる。もちろんネームスペースでユーティリティメソッド群を実装する場合にも通じる…

had a session at talk.js

If you are English user, visit meetup.com to find my slide. 昨晩マイクロソフト@シンガポールでtalk.jsに参加してきました。レベルが高そうなJSプログラマが集う場所にJavaプログラマが潜り込むという構図を活かして笑いを取るなどしました。 前回*1は…

altWebSiteなるものを妄想してみる

HTML/CSS/JavaScriptを複雑に組み合わせてアプリケーションを作ろうという大きい流れがありますが、そもそも「アプリケーションを書くことを想定していないモノ」で無理矢理作ること自体に無理があるよねという考えがあってもいいと思います。 altJSがいくつ…

RequireJSを活用したキャッシュ防止、A/Bテスト、画像事前読込など

[for English user] This article is a simple introduction about my project for Japanese developer. You do not have to read this, reading this project directly would be enough. RequireJSの応用方法について調べた内容をGitHubでまとめています。…

log: 2013/Feb/25 ~ Mar/3

Interests Nexus 7 has come! Now I got a Nexus 7 (32G Wifi/3g)! I have rooted it and configured some useful applications. I will think how to use it as a terminal for development. I wish browser-base IDE like Cloud9 IDE supports tablet, but…

log: 2013/Feb/16~24

Outputs RequireJS dependency graph plugin I found that r.js does not execute define function because it uses AST. It means that wrapping define function has no meaning. I think I need to use parentMap to know dependency, but currently I ca…

log: 2013/Feb/4~15

Interests FireFox OS Currently I do not like Android and iOS, so I hope that this OS (or Ubuntu) become popular and make the market actively. But they would be minor... Outputs This week is long holiday (the head of lunar new year), so I d…

Drawing graph about dependency between AMD modules

Sometimes I want to know dependency between AMD modules graphically, because it might be helpful to understand complexity. Today I have tried to realize it. AMDモジュール間の依存関係をおおまかに把握したい時って結構あります。規約どおりの依…

enchant.jsはモジュール化するといいと思う

enchant.jsをもっと簡単に使えるようにしようという話が大変興味深かったので、1ユーザとして思うところを。 なお私は業務ではenchant.jsを使わないし、プライベートでもここ数カ月ほぼ触っていないので、最近の変更はあまり追えていないかもしれないです。…

requirejs reading

I found that RequireJS has became one of my favorite library, so I need to know it deeply to make it my strong point. This article is log of code reading for 2.0.4. require.js it has many helper like bind(), mixin() and each(). IE6 support…

PARTAKE開発に復帰します

中国への引越しなどがあって疎遠になっていたPARTAKE開発ですが、このたびPARTAKEのGitHubへの引越しを機に復帰します。今後はマイルストーンに従いつつ、テストの充実とCIの導入、いろんな実験ができればいいなと持っています。今まで迷惑をかけてしまって…

How to improve interface for JavaScript

Do you still use argument to give information for other components? It's the most simple way, but sometimes it's too long to read. We can use other approach like named parameter, chain and deferred. Named parameter function foo(param) { al…

RequireJS 2.0による依存関係の明示、フォールバック、複数バージョンの混在

旧ブログのRequireJSネタがひそかにブクマされつづけているので需要があるかなと思い、最近調査したバージョン2.0の機能についてまとめます。元ネタはこちらです。 Upgrading to RequireJS 2.0 · jrburke/requirejs Wiki · GitHub 依存関係の明示 従来のバー…

Simple timer for LT

I've released a simple timer for lightning talk. This tool creates small window at front of your screen. So it's useful to measure left time for talking. ライトニングトーク用のタイマーをリリースしました。残り時間を画面の手前側に表示するた…

New game for learning Periodic Table

I've posted new game to 9leap. I designed this game for junior high school students to learn Periodic Table. This is the first version of this game, so it's very simple. 新しいゲームを9leapに投稿しました。中学生が周期表を学ぶために使えるゲ…

Rakefile generator for enchant.js

I've created a website which generates Rakefile for enchant.js programming in my GitHub pages. Currently it supports 3 plugins. Please try to use if you're interested in. 先日作ったRakefileを主要プラグインに対応させつつ汎用化しました。Init…

Rakefile for enchant.js programming

I found that starting game programming with enchant.js is slow. It has a lot of steps like creating index.html, downloading enchant.js and plugins, downloading images for plugins... it's boring, isn't it? 最近enchant.jsによる開発の「初速」…

Reading source of Hatena Blog

Today I read a source (HTML, JS, CSS) of this blog. This entry is my impression. このブログのソースを読んでみたので、感想をまとめておきます。 CSS/JS isn't pre compressed? To load basic CSS files and JS files, this blog uses very long URI w…

How dynjs handles function

I traced how dynjs execute javascript last month. Today I try to trace how dynjs handles function. creating javascript I created a script which has a function returns x2 of argument. function doubleFunction (arg) { return arg * 2; } It cre…

How to accelerate launching your HTML game

HTML5ゲームに関するイベントleapfestに参加してきました。そしてLTの機会もいただけたので、旧ブログでも触れた起動高速化について話させていただきました。ここに絞って基本戦略とか横断的なネタとかをまとめたのが意外と楽しかったです。 なおスライドはS…

How dynjs runs javascript

※ブログ記事と言うよりはメモのようなものなので、日本語は省略します。 I'm trying to read dynjs. At 1st, let's try to know how it executes given javascript. READY TO READ build it and create an IDE project There is a wiki page to introduce ho…

released a gl.enchant.js sample

I released a sample project for gl.enchant.js. You can run this project to access here. I want to use acceleration sensor with, but iPhone isn't WebGL ready yet, so I don't use it. gl.enchant.jsを使ったサンプルをGitHubに公開しました。加速…