Skip to content

Instantly share code, notes, and snippets.

View EasonPai's full-sized avatar

Eason PI EasonPai

  • Eason Pai
  • Taipei, Taiwan
View GitHub Profile
ReceivePort main_receive; // "RecievePort" for main(/root) thread
SendPort remote_sender; // "SendPort" of main_receive
void initIsolate() {
// create a "RecievePort" for current thread, which is main thread at this point
main_receive = new ReceivePort();
// listen to upcoming messages
main_receive.listen((payload) {
if (remote_sender is SendPort) {
@EasonPai
EasonPai / parsing_ptt_price_tag.dart
Last active April 19, 2016 14:54
My attempts to parse price tag out of a PTT article with regular price annotation format with Dart lang
void main() {
String t1 = '''[交易價格]:面交3300 / 全家3400
[其他備註]:''';
String t2 = '''[交易價格]:9000
[其他備註]:''';
void firebase_demo() {
// creating a firebase database reference
Firebase firebaseRef = new Firebase("https://lab-of-pai.firebaseio.com/");
// writing data
firebaseRef.set({"hello": "world"}).then((_) {
// after data is set
print("after data is set");
});
@EasonPai
EasonPai / Gauge.as
Last active December 22, 2015 06:49 — forked from PrimaryFeather/Gauge.as
Added a small enhancement to get cleaner usage. Gauge's constructor accepts background and foreground image, these 2 images will align to center automatically.
/**
* Example:
*
* var gauge:Gauge = new Gauge( YourFgTextureHere , YourBgTextureHere);
* addChild(gauge);
**/
package starling.extensions
{
import flash.geom.Point;