Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🦁

Takuto Wada twada

💭
🦁
View GitHub Profile
@twada
twada / babel.config.js
Last active Jan 15, 2019
example: unassert but preserve comments
View babel.config.js
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 Apr 14, 2016
power-assert in development, unassert in production
View .babelrc
{
"env": {
"development": {
"presets": [
"babel-preset-power-assert"
]
},
"production": {
"plugins": [
"babel-plugin-unassert"
@twada
twada / gulpfile.js
Last active Jan 31, 2016
espower-coffee を使ってコード生成を経ずに (gulp-espower を使わずに) CoffeeScript + power-assert を使うデモ (npm test でも gulp test でも動きます)
View gulpfile.js
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 Aug 29, 2015
power-assert 多段 SourceMap 対応の方針
View multi-stage-sourcemaps-strategy.md

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 Aug 29, 2015
zombie.js の browser.assert を power-assert 化する試み(試してはいない)
View empowerZombieBrowser.js
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 Mar 30, 2014
empower.js that throws new AssertionError, not throwing (coping with browserify-ed code under PhantomJS)
View empower.js
/**
* 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:
View wikipedia_ja.rb
# -*- 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 Sep 6, 2012 — forked from ainame/shibuya-el-position-paper.md
shibuya.elのポジションペーパーです。githubアカウントをお持ちの方はforkしてお使いください。
View shibuya-el-position-paper.md

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

Personal

@twada
twada / jojo_rush_formatter.rb
Created May 11, 2011
突き(ラッシュ)の速さ比べ
View jojo_rush_formatter.rb
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
View 1 test_helper.js
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;
You can’t perform that action at this time.