- [Angular.js][]
- [Backbone.js][]
- [CasperJS][]
- [CoffeeScript][]
- [Grunt][]
- [istanbul][]
- [JavaScript][]
- [Karma][]
- [Mocha][]
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
### | |
$mocha test.coffee --compilers coffee:coffee-script/register --reporter=spec --timeout=20000 | |
outside | |
before | |
before done | |
beforeeach | |
beforeeach done | |
out it | |
✓ out it |
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
(function(ul, filter){ | |
var getGeneration = function(li){ | |
var f = function(li, count){ | |
var parent = li.parentNode; | |
if (parent.nodeName !== 'UL'){ | |
return count - 1; | |
} | |
return f(parent.parentNode, ++count); | |
} |
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
// parseCsv('f1,2\nf2,3\nf3,4\n', ['name', 'value']) | |
// => [{"name":"f1", "value":"2"}, {"name":"f2", "value":"3"}, {"name":"f3", "value":"4"} ] | |
export default function parseCsv(str, header){ | |
var lines = str.split('\n'); | |
return lines.map((ln) => { | |
var items = ln.split(','); | |
var ob = {}; | |
header.forEach((it, count)=>ob[it] = items[count]); | |
return ob; | |
}); |
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
http://www.softantenna.com/wp/software/5-programming-problems/ | |
https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour |
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
// ==UserScript== | |
// @name POSTDを軽くする | |
// @namespace http://your.homepage/ | |
// @version 0.1 | |
// @description enter something useful | |
// @author You | |
// @match http://postd.cc/** | |
// @grant none | |
// ==/UserScript== |
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'; | |
// 変数 a はblockスコープの中でも外でも再代入可能な有効な変数です。変数宣言の方法(var|let|const)のいずれを利用するべきか検討してください | |
var a = 5; | |
// 変数 b は再代入不可能な変数です。変数宣言の方法(var|let|const)のいずれを利用するべきか検討してください | |
const b = process.argv[2]; | |
if (a === 5) { | |
// ここでの変数 c は再代入可能ですが、このblockの中でだけ有効な変数です。変数宣言の方法(var|let|const)のいずれを利用するべきか検討してください。 | |
let c = 4; |
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 EventEmitter = require('events').EventEmitter; | |
var inherits = require('util').inherits; | |
var Callee = function(){}; | |
inherits(Callee, EventEmitter); | |
var o = new Callee(); | |
o.on('first', function(){ | |
console.log('first'); |
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
#raw_list = STDIN.gets.chomp.split("\n").collect {|item| item.to_i} | |
raw_list = [] | |
while str = STDIN.gets#.chomp | |
break if str.empty? | |
raw_list.push str.to_i | |
end | |
count_changed = 0 | |
raw_list.each_with_index do |item, index| | |
if item != (index + 1) then |
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
inputs = [] | |
while str = STDIN.gets.chomp | |
break if str.empty? | |
inputs.push str.split(',').collect {|i|i.to_i} | |
end | |
class Amida | |
def initialize (yokobous) | |
@yokobous = yokobous.clone | |
@amida_length = @yokobous[0].length + 1 |