こんにちは。今回は現実逃避を兼ねて Jade の素晴らしさをお伝えしたいと思います。
[Jade][0] は JST (JavaScript Templates) の一つであり、HTML を書くための[軽量マークアップ言語][1] である [Haml][2] に影響を受けた JavaScript テンプレートエンジンでもあります。
| # If you meet install errors, see abid-hussain's comment | |
| sudo apt-get --force-yes install build-essential openssl libreadline6 libreadline6-dev curl git-core \ | |
| zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \ | |
| libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison | |
| && | |
| \curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled |
| /** | |
| * See: Build Configuration File (alloy.jmk) | |
| * http://docs.appcelerator.com/titanium/3.0/#!/guide/Build_Configuration_File_(alloy.jmk) | |
| */ | |
| task("pre:compile", function(event, logger) { | |
| logger.showTimestamp = true; | |
| logger.info('alloyConfig.platform = ' + event.alloyConfig.platform); | |
| logger.info('alloyConfig.version = ' + event.alloyConfig.version); |
| $! raise された例外オブジェクト | |
| $" require で読み込まれたファイルの配列 | |
| $# | |
| $$ 現在のプロセス ID | |
| $% | |
| $& 正規表現にマッチした箇所の文字列 | |
| $' 正規表現にマッチした箇所より後ろの文字列 | |
| $( | |
| $) | |
| $* Ruby スクリプトに指定された引数。ARGV と同じ |
| // this file located in /Library/Application Support/Titanium/mobilesdk/osx/{version_number} | |
| // add the following methods to GeolocationModule.mm | |
| - (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region | |
| { | |
| NSDictionary *event = [NSDictionary dictionaryWithObjectsAndKeys:NUMBOOL(YES),@"success",[NSDictionary dictionaryWithObjectsAndKeys:NUMDOUBLE(region.center.latitude),@"lat",NUMDOUBLE(region.center.longitude),@"lng",NUMDOUBLE(region.radius),@"radius",region.identifier,@"identifier",nil],@"region",nil]; | |
| if ([self _hasListeners:@"enteredRegion"]) | |
| { | |
| [self fireEvent:@"enteredRegion" withObject:event]; |
| // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
| // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
| // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
| // MIT license | |
| (function() { | |
| var lastTime = 0; | |
| var vendors = ['ms', 'moz', 'webkit', 'o']; |