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 'un-define) | |
(setq debug-on-error t) | |
(setenv "SSH_AUTH_SOCK" "/tmp/501/SSHKeychain.socket") | |
(setq transient-mark-mode nil) | |
(setq-default case-fold-search t) | |
(require 'package) | |
(package-initialize) | |
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) |
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
const promisify = require('util.promisify'); | |
/** | |
* Promisifyはコールバックのパラメータの最初の一つしか返さない。 | |
* | |
* $ node promisify_test.js | |
* [ 'a', undefined, undefined ] | |
* { '0': 'a' } | |
*/ |
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
const co = require('co'); | |
// 0‾1秒の処理 | |
const proc = function*() { | |
const wait = Math.random(); | |
return new Promise(resolve => | |
setTimeout(function() { | |
return resolve(wait); | |
}, wait * 1000) | |
); |
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
; nvm環境で、npm install -g prettier | |
; M-x list-packages で nvm と prettierを追加 | |
; init.elに追加 | |
(require 'nvm) | |
(nvm-use "v6.11.0") | |
(add-hook 'js2-mode-hook 'prettier-js-mode) | |
(add-hook 'web-mode-hook 'prettier-js-mode) |
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
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 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
'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 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にアクセス可能。 |
NewerOlder