前回 https://gist.github.com/ryohey/b31fb1cd69ddaed5f36f
- CEO
| express = require "express" | |
| multiparty = require "multiparty" | |
| app = express() | |
| app.get "/", (req, res) -> | |
| res.send """ | |
| <form action="/" enctype="multipart/form-data" method="post"> | |
| <input type="file" name="uploadFile"> | |
| <input type="submit"> |
| # launch the mongoDB before running the server | |
| # mongod --dbpath /path/to/db | |
| # ------------------------------ | |
| # passport | |
| # ------------------------------ | |
| passport = require("passport") | |
| TwitterStrategy = require("passport-twitter").Strategy |
| Twit = require "twit" | |
| twit = new Twit | |
| consumer_key: "TWITTER_CONSUMER_KEY" | |
| consumer_secret: "TWITTER_CONSUMER_SECRET" | |
| access_token: "ACCESS_TOKEN" | |
| access_token_secret: "ACCESS_TOKEN_SECRET" | |
| twit.get "account/verify_credentials", (err, data, res) -> | |
| twitterId = data.id |
| next = (value) -> "🐱"+value | |
| back = (value) -> value.slice("🐱".length, value.length) | |
| zero = "🐶" | |
| # next = (value) -> [value] | |
| # back = (value) -> value.pop() | |
| # next = (value) -> -> value | |
| # back = (value) -> value() |
| remote = global.require "remote" | |
| child_process = remote.require "child_process" | |
| class Foo | |
| start: -> | |
| @child = child_process.spawn "fooProgram", [barArgument] | |
| doFooBar: (arg1, callback) -> | |
| @child.stdin.write arg1 |
| json2html = (obj) -> | |
| if obj instanceof Array | |
| list = json2html o for o in obj | |
| <ul>{list}</ul> | |
| else if obj instanceof Object | |
| list = ([ | |
| <dt>{key}</dt> | |
| <dd>{json2html value}</dd> | |
| ] for key, value of obj) | |
| <dl>{list}</dl> |
| // | |
| // main.cpp | |
| // FaceTracker | |
| // | |
| // Created by ryohey on 2015/12/11. | |
| // | |
| #include <iostream> | |
| #include <cv.h> | |
| #include <highgui.h> |
| fs = require "fs" | |
| req = require "request" | |
| ## config | |
| teamName = "your esa.io team name" | |
| accessToken = "your esa.io personal access token" | |
| # the directory markdown files saved (git clone git@github.com:USERNAME/REPONAME.wiki.git) | |
| dir = "path/to/reponame.wiki" |
| logTm = (tm) -> | |
| text = tm.colors | |
| .map (s, i) -> if i is tm.pos then "%c" + ["▲", "▼"][tm.state] else "%c " | |
| .join "" | |
| style = tm.colors.map (c) -> "background-color:" + ["white", "yellow", "orange"][c] + ";" | |
| console.log.apply console, [text].concat style | |
| # [state, color] = [state, color, offset] | |
| rule = {} | |
| rule[[0, 2]] = [0, 1, -1] |