Skip to content

Instantly share code, notes, and snippets.

View koba04's full-sized avatar

Toru Kobayashi koba04

View GitHub Profile
@koba04
koba04 / 1.constructor.md
Last active September 1, 2015 03:30
How to Vue.js compile ViewModel

これがどうやってCompileされるのか追ってみる

vm = new Vue({
  el: "#content",
  data: {
    name: "taro",
  }
})
// escape
javascript:var d = document;d.open();d.write(escape("変換したい文字列").replace(/%/g, "\\"));d.close();
// => \u5909\u63DB\u3057\u305F\u3044\u6587\u5B57\u5217
// unescape
javascript:var d = document;d.open();d.write(unescape("\u5909\u63DB\u3057\u305F\u3044\u6587\u5B57\u5217"));d.close();
// => 変換したい文字列
@koba04
koba04 / closure_perl.pl
Created November 5, 2010 16:33
sample of closure by perl
#!/usr/bin/env perl
use strict;
use warnings;
sub make_closure {
my $cnt = 0;
return sub {
++$cnt;
}
@koba04
koba04 / closure_sample_akb.pl
Created November 5, 2010 17:52
Closure Sample (AKBを使って)
#!/usr/bin/env perl
use utf8;
use strict;
use warnings;
use Encode;
use List::Util qw/shuffle/;
# AKB 48 って48人ではない?
@koba04
koba04 / Class_Data_Inheritable_Test.pl
Created November 5, 2010 17:20
Class::Data::Inheritable Test
#!/usr/bin/env perl
package Foo;
use base qw/Class::Data::Inheritable/;
Foo->mk_classdata('ClassName', 'Foo');
1;
package Foo::Bar;
@koba04
koba04 / push_undef.pl
Created November 6, 2010 17:12
配列にundefなどを追加してみるテスト
#!/usr/bin/env perl
use utf8;
use strict;
use warnings;
use Test::More;
my @list = (1..3);
@koba04
koba04 / worker.pl
Created January 14, 2011 10:23
Gearman Worker Script
#!perl
use strict;
use warnings;
use utf8;
use Gearman::Worker;
my $worker = Gearman::Worker->new;
my $cnt = 0;
$worker->job_servers('127.0.0.1');
@koba04
koba04 / client.pl
Created January 14, 2011 10:22
Gearman Client Script
#!perl
use strict;
use warnings;
use utf8;
use Gearman::Client;
use Gearman::Task;
my $client = Gearman::Client->new;
$client->job_servers('127.0.0.1');
@koba04
koba04 / object.create.js
Created March 19, 2011 07:14
FirefoxなどObject.createを使えないときに
if (typeof Object.create === 'undefined') {
Object.create = function (o) {
function F() {}
F.prototype = o;
return new F();
};
}
#import <UIKit/UIKit.h>
@interface TableViewSampleViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>{
UITableView *sampleTable;
NSArray *tableData;
}
@property (nonatomic, retain) IBOutlet UITableView *sampleTable;
@end