Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🔪

Takayosi Amagi fand

💭
🔪
View GitHub Profile
View cpusound.js
var spawn = require('child_process').spawn;
var top = spawn('top', ['-b', '-d', '1']);
var buf = '';
top.stdout.on('data', function(data){
buf = data.toString();
});
var baudio = require('baudio');
var b = baudio(function (t, i) {
@fand
fand / check-odd.coffee
Created Sep 20, 2014
Q.Promiseつかう
View check-odd.coffee
## いろいろなPromiseライブラリを使ってみる
## Qだけthrow new Errorが捕まえられなかった
# {Promise} = require 'es6-promise'
Promise = require('q').Promise
# Promise = require 'bluebird'
checkOdd = (num) ->
return new Promise (resolve) ->
if typeof num isnt 'number'
@fand
fand / initManually.js
Created Jul 11, 2015
WDIO3 multi browser test
View initManually.js
'use strict';
var webdriverio = require('webdriverio');
var assert = require('assert');
describe('top page', function () {
var chrome, firefox;
before(function *() {
chrome = webdriverio.remote({ desiredCapabilities : {browserName : 'chrome'} });
@fand
fand / memo.md
Last active Aug 29, 2015
Esprima Syntax メモ
View memo.md

かならず Program で始まる

Program

  • type
  • body: [Statement]
    • ExpressionStatement, VariableDeclaration, EmptyStatement, DebuggerStatement, TryStatement が入る?
@fand
fand / router.js
Created Jul 17, 2015
Promiseベースの簡易ルータ
View router.js
const EVENT = (pageID) => 'register:' + pageID
class Router extends EventEmitter {
constructor () {
this.routes = {};
}
getController (pageID) {
return new Promise((resolve, reject) => {
this.once(EVENT(pageID), function () {
@fand
fand / .eslintrc
Created Sep 30, 2015
厳し目のeslintrcできた
View .eslintrc
{
"parser": "babel-eslint",
"env": {
"es6" : true,
"node" : true,
"browser" : true,
"mocha" : true,
},
@fand
fand / no-japanese.js
Last active Jun 1, 2016
日本語禁止するESLintルール
View no-japanese.js
/**
* @fileoverview Rule to forbid writing Japanese
* @author amagitakayosi
*/
"use strict";
var path = require('path');
//------------------------------------------------------------------------------
@fand
fand / eslint.js
Created Oct 1, 2015
勤怠と同時にESLint設定かえるくん
View eslint.js
'use strict';
var fs = require('fs-promise');
var SECRET = require('../SECRET');
module.exports = function (mode) {
// ESLint設定を変更する
var indentValue;
@fand
fand / npmenv
Last active May 20, 2019
npmenv
View npmenv
#!/bin/bash
# .npmを作成
if [ ! -e .npm ]; then
mkdir .npm
fi
# npm本体をインストール
NPM_VERSION=$(echo $1 || cat .npm-version || npm -v)
if [ ! NPM_VERSION = $(npm -v) ]; then
@fand
fand / flux_history.md
Last active Oct 19, 2016
Flux戦争の歴史
View flux_history.md

Flux戦争の歴史メモ

Fluxxor by binarymuse

  • 2014/05/12 first commit
    • F8での "Flux" の登場からわずか4日
  • 素朴な実装
  • mixinベースの機能
    • 〜React v0.12という感じ

Reflux by spoike