This file contains 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 Browser = require('zombie').Browser; | |
var browser = new Browser({ | |
debug: true, | |
runScripts: true | |
}); | |
browser.window.DEBUG_VALUE = "testing"; | |
browser.visit(url).then(function () { | |
//実行されるウインドウ内のJavaScriptで window.DEBUG_VALUEにアクセス可能。 |
This file contains 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
'use strict'; | |
var Deferred = require('jquery').Deferred; | |
var countup = exports.countup = function(start, count) { | |
if (typeof count == 'undefined') { | |
count = start; | |
start = 0; | |
} | |
var i = start; |
This file contains 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 Lazy = require('lazy'); | |
var fs = require('fs'); | |
var path = require('path'); | |
var filename = path.join(__dirname, './textfile.txt'); | |
var skip_lines = 1; | |
var data = ""; | |
Lazy(fs.createReadStream(filename, {encoding: 'utf8', autoClose: true})).lines.skip(skip_lines).map(function(buf) { | |
data += buf.toString() + '\n'; |
This file contains 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
describe "orders" do | |
it "should pass security_code argument to payment api on saving" do | |
payment.should_receive(:exec_tran).with(hash_including(:security_code)) | |
order.save | |
end | |
end |
This file contains 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 moment = require('moment'); //http://momentjs.com/ | |
var day1 = moment(); | |
day1.format(); | |
//'2014-03-07T15:41:11+09:00' | |
// momentのインスタンスに対するメソッド呼び出しは破壊的なのに注意。 | |
// http://momentjs.com/docs/#/manipulating/ | |
var day2 = day1.add('days', 1); | |
day2.format(); |
This file contains 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
0x30fc ー KATAKANA-HIRAGANA PROLONGED SOUND MARK 長母音 | |
0x2212 − MINUS SIGN 全角マイナス | |
0xff0d - FULLWIDTH HYPHEN-MINUS Windowsの全角マイナス | |
0x2010 ‐ HYPHEN | |
0x2011 ‑ NON-BREAKING HYPHEN | |
0x0212 ‒ FIGURE DASH | |
0x2013 – EN DASH | |
0x2014 — EM DASH | |
0x2015 ― HORIZONTAL BAR |
This file contains 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 gulp = require('gulp'); | |
var browserify = require('browserify'); | |
var stringify = require('stringify'); | |
var source = require('vinyl-source-stream') | |
var mocha = require('gulp-mocha'); | |
var gutil = require('gulp-util'); | |
var clean = require('gulp-clean'); | |
var path = require('path'); | |
var connect = require('gulp-connect'); | |
var exposify = require('exposify'); |
This file contains 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
// ES5のArrayのmapメソッッド | |
// val()メソッドを持つオブジェクトの配列arrに対し、それぞれval()メソッドを実行して配列に入れる。 | |
var result = arr.map(function(v) { | |
return v.val(); | |
}); | |
// この感覚でjQueryを使ってはいけない。 | |
// http://api.jquery.com/map/ | |
// まず引数が違う |
This file contains 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 Vue = require('vue'); | |
var moment = require('moment'); | |
var momentja = require('moment/lang/ja'); // browserifyでライブラリを読み込ませるのに必要 | |
Vue.filter('dateFormat', function(value, format) { | |
moment.lang('ja'); | |
return moment(value).format(format); | |
}); |
This file contains 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
require 'spec_helper' | |
describe AdminController do | |
describe "accessed by admin" do | |
# response.body で返る内容をテストするには render_views が必要 | |
# https://www.relishapp.com/rspec/rspec-rails/docs/controller-specs/render-views | |
render_views | |
it "should show orders element" do | |
sign_in admin | |
get 'index' |
OlderNewer