This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //[email protected]ばん | |
| var gulp = require('gulp'); | |
| var stylus = require('gulp-stylus'); | |
| gulp.task('stylus', function () { | |
| return gulp.src('./styl/style.styl') | |
| .pipe(stylus({ | |
| url: { | |
| //name:'url'とするとぜんぶのurl()がbase64埋め込みになる |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var async = require('async'); | |
| var tasks = { | |
| get: function(done){ | |
| console.log('get'); | |
| setTimeout(done, 1000); | |
| }, | |
| send: function(done){ | |
| console.log('send'); | |
| //setTimeout(done, 1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var async = require('async'); | |
| var retry = require('retry'); | |
| var tasks = { | |
| get: function(done){ | |
| console.log('get'); | |
| setTimeout(done, 1000); | |
| }, | |
| send: function(done){ | |
| console.log('send'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var _ = require('lodash'); | |
| var retry = require('retry'); | |
| // 試行のサンプルメソッド | |
| var test = function(callback){ | |
| _.delay(function(){ | |
| var arg; | |
| //20%の確率で成功、みたぃな | |
| var num = _.random(0, 4); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var deferred = require('deferred'); | |
| var _ = require('lodash'); | |
| var def = deferred(); | |
| _.delay(function(){ | |
| def.reject(new Error('error')); | |
| //def.resolve('success'); | |
| }, 1000); | |
| def.promise.cb(function(result){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var inbox = require('inbox'); | |
| var config = require('./config.json'); | |
| var imap = inbox.createConnection( | |
| false, 'imap.gmail.com', { | |
| secureConnection: true, | |
| auth: config.mail.auth | |
| } | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var util = require('util'); | |
| var _ = require('lodash'); | |
| var bunyan = require('bunyan'); | |
| function MyRingBuffer(options){ | |
| bunyan.RingBuffer.call(this, arguments) | |
| } | |
| util.inherits(MyRingBuffer, bunyan.RingBuffer); | |
| MyRingBuffer.prototype.write = function(record){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var deferred = require('deferred'); | |
| var Backbone = require('backbone'); | |
| var _ = require('lodash'); | |
| var timer = [ | |
| {load: 1000, timeout: 2000}, | |
| {load: 3000, timeout: 2000} | |
| ]; | |
| var Sample = Backbone.Model.extend({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var cv = require('opencv-node'); | |
| var path = require('path'); | |
| var fullpath = path.resolve('./lena.png'); | |
| console.log('Opening ', fullpath); | |
| var src = cv.imread(fullpath, -1); | |
| if(src.empty) return console.log('Error opening file'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title>dc.js - Scatter And Line Plot</title> | |
| <meta charset="UTF-8"> | |
| <link rel="stylesheet" href="../css/dc.css"/> | |
| <style> | |
| body{ | |
| background: black; | |
| } |