Skip to content

Instantly share code, notes, and snippets.

@ishiduca
ishiduca / data.js
Last active December 12, 2015 07:18
http-cookies 用の cookie_jar.cookies を生成する Generator と Data
var data =
module.exports = {
domain: ('.pixiv.net www.pixiv.net i9.pixiv.net img.pixiv.net .pixiv.org').split(' ')
, path: ('/ /pro /profile /prototype /pro/file').split(' ')
, key: ('PHPSESSID node_session_id ID _id over18').split(' ')
, value: ('red <> blue <> black <> white <> yellow <> yelow hearts <> B&L <> abc=ABC;')
.split(' <> ')
};
@ishiduca
ishiduca / gist:4752399
Last active December 12, 2015 09:29
QUnit + qunit-tap のテスト環境
@ishiduca
ishiduca / gist:4754104
Last active February 4, 2016 12:26
phantomjs install and more...

phantomjs install & build

install and build

PhantomJS: Build Instructions

$ git clone git://github.com/ariya/phantomjs.git
$ cd phantomjs
$ git checkout 1.8
@ishiduca
ishiduca / directory
Last active December 13, 2015 16:58
qunit-tap の準備
/project/
-- test_helper.js
/t/
-- test_sample.js
/xt/
-- test_async_sample.js
@ishiduca
ishiduca / countup.js
Last active December 13, 2015 17:59
Re: 「はじめてのReadable Stream - 四角革命前夜」 http://d.hatena.ne.jp/sasaplus1/20130213/1360688911
var counter = new CounterStream;
counter.on('error', function (err) {
console.error(err);
process.exit(1);
});
counter.on('data', function (count) {
process.stdout.write(count + "\n");
@ishiduca
ishiduca / directory
Created February 24, 2013 01:33
phantomjs + Qunit + qunit-tap でのテストサンプル
/Project/
-- /lib/
-- timer.js
-- /t/
-- index.html
-- run-qunit.js (https://raw.github.com/ariya/phantomjs/master/examples/run-qunit.js)
-- test.js
-- /node_modules/
-- /qunit-tap/
-- /qunitjs/
@ishiduca
ishiduca / emitter.js
Last active December 14, 2015 07:59
browser-side-event-emitter
function Emitter () {/* this.evs = {}; */}
(function (ep) {
ep.emit = function () {
var args = [].slice.apply(arguments);
var eventName = args.shift();
if (! this.evs) this.evs = {};
if (! this.evs[eventName]) return;
@ishiduca
ishiduca / mongoose_save_img.js
Created April 16, 2013 03:35
mongooseで MongoDB に画像保存するやつのサンプル
var path = require('path');
var fs = require('fs');
var mongoose = require('mongoose');
var mime = require('mime');
var ImageSchema = new mongoose.Schema({
img: Buffer
, mime: String
});
@ishiduca
ishiduca / fmap.js
Created April 18, 2013 01:17
ハッシュのプロパティ名(key)に関数を利用する例。使い場所ないのでここに
(function (define) {
define([], function () {
var mod = {};
mod.Fmap = function () {};
var fp = mod.Fmap.prototype;
fp.map = function (type, opt) {
if ('function' !== typeof type) {
@ishiduca
ishiduca / setup.pl
Last active December 16, 2015 14:49
js-TDD用のセッテアップスクリプト
#!/usr/bin/env perl -s
use strict;
use warnings;
use File::Spec;
use File::Basename qw(dirname basename);
use File::Copy qw(move);
use LWP::Simple qw(mirror);
use Data::Section::Simple qw(get_data_section);
@ARGV or die qq(usage: $0 [-phantom] projectname);