Skip to content

Instantly share code, notes, and snippets.

View twada's full-sized avatar
💭
🦁

Takuto Wada twada

💭
🦁
View GitHub Profile
@twada
twada / babel.config.js
Last active January 15, 2019 08:16
example: unassert but preserve comments
module.exports = function (api) {
const presets = [];
const plugins = [];
let retainLines = false;
let comments = true;
if (api.env('production')) {
plugins.push('babel-plugin-unassert');
retainLines = true;
}
@twada
twada / .babelrc
Last active April 14, 2016 06:59
power-assert in development, unassert in production
{
"env": {
"development": {
"presets": [
"babel-preset-power-assert"
]
},
"production": {
"plugins": [
"babel-plugin-unassert"
@twada
twada / gulpfile.js
Last active January 31, 2016 10:50
espower-coffee を使ってコード生成を経ずに (gulp-espower を使わずに) CoffeeScript + power-assert を使うデモ (npm test でも gulp test でも動きます)
var gulp = require('gulp');
var mocha = require('gulp-mocha');
gulp.task('test', function () {
require('espower-coffee/guess');
return gulp
.src('test/**/*.coffee')
.pipe(mocha());
});
@twada
twada / multi-stage-sourcemaps-strategy.md
Last active August 29, 2015 14:05
power-assert 多段 SourceMap 対応の方針

power-assert 多段 SourceMap 対応の方針

試験は twada/battlefield-sourcemaps で行っている

power-assert 出力行の補正

  • SourceMap 対応が入った espower 0.9.0 を使う
  • espower(ast, options) の第二引数 options に sourceMap というキーで上流の SourceMap オブジェクトを入れる
@twada
twada / empowerZombieBrowser.js
Last active August 29, 2015 14:03
zombie.js の browser.assert を power-assert 化する試み(試してはいない)
var empower = require('empower');
var formatter = require('power-assert-formatter');
module.exports = function empowerZombie (browser) {
empower(browser.assert, formatter(), {
destructive: true,
modifyMessageOnRethrow: true,
saveContextOnRethrow: true,
patterns: [
'browser.assert.redirected([message])',
@twada
twada / empower.js
Created March 30, 2014 11:11
empower.js that throws new AssertionError, not throwing (coping with browserify-ed code under PhantomJS)
/**
* empower.js - Power Assert feature enhancer for assert function/object.
*
* https://github.com/twada/empower
*
* Copyright (c) 2013-2014 Takuto Wada
* Licensed under the MIT license.
* https://raw.github.com/twada/empower/master/MIT-LICENSE.txt
*
* A part of extend function is:
# -*- coding: utf-8 -*-
# Find japanese entry for each en.wikipedia.org link in TARGET_URL (quick & dirty hack)
# USAGE: ruby wikipedia_ja.rb TARGET_URL
require 'rubygems'
require 'nokogiri'
require 'open-uri'
def ja_url_for(url)
link_ja = Nokogiri::HTML(open(url)).css('li.interlanguage-link.interwiki-ja a').first
@twada
twada / shibuya-el-position-paper.md
Created September 6, 2012 07:33 — forked from ainame/shibuya-el-position-paper.md
shibuya.elのポジションペーパーです。githubアカウントをお持ちの方はforkしてお使いください。

Shibuya.el#1 ポジションペーパー

Personal

@twada
twada / jojo_rush_formatter.rb
Created May 11, 2011 09:13
突き(ラッシュ)の速さ比べ
require 'spec/runner/formatter/progress_bar_formatter'
class JojoRushFormatter < Spec::Runner::Formatter::ProgressBarFormatter
def example_failed(example, counter, failure)
@output.print colorize_failure('無駄', failure)
@output.flush
end
def example_passed(example)
@output.print green('オラ')
@output.flush
exports = module.exports = global;
var path = require('path');
QUnit = require(path.join(path.dirname(require.resolve('qunit-tap')), '..', 'vendor', 'qunit', 'qunit', 'qunit')).QUnit;
require("qunit-tap").qunitTap(QUnit, require("sys").puts, { noPlan: true });
QUnit.init();
QUnit.config.updateRate = 0;
exports.assert = QUnit;