Skip to content

Instantly share code, notes, and snippets.

View moriiimo's full-sized avatar
🏋️‍♂️
power

moriiimo moriiimo

🏋️‍♂️
power
  • Tokyo
View GitHub Profile
{
"title": "my setting",
"rules": [
{
"description": "send esc and eisuu if capslock typed",
"manipulators": [
{
"from": {
"key_code": "caps_lock",
"modifiers": {

ES6

文法の基礎

変数展開

左辺にもブレスを書いて配列展開できる

[es6]
var arr = [1,2,3];
@moriiimo
moriiimo / gist:5428825
Created April 21, 2013 07:59
呼び出し元の引数を別の関数内で書き換えることができる。(IE限定)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>IEだけでできること:呼び出し元の引数を壊す</title>
<script type="text/javascript" src="../js/lib/jquery-1.9.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="../css/style.css"/>
</head>
@moriiimo
moriiimo / gist:5395204
Created April 16, 2013 11:24
vim : 文字列置換
以下の文字を
Mon
Tue
Wed
Thu
Fri
Sat
Sun
@moriiimo
moriiimo / gist:5395003
Created April 16, 2013 10:46
100をfor, whileを使わないでconsole.logで出力する。: level13 - consoleオブジェクトを使って出力してはいけません
$(function({
new Array(Number(["s".length, "".length, "".length].join(""))).toString().split(",").filter(function(val, index){ opera.postError(-~index); });
});
@moriiimo
moriiimo / gist:5387450
Last active December 16, 2015 05:49
// 100をfor, whileを使わないでconsole.logで出力する。 : level12 - level12 - Booleanオブジェクト、プリミティブなbooleanを使ってはいけません
$(function(){
new Array(Number(["s".length, "".length, "".length].join(""))).toString().split(",").filter(function(val, index){ console.log(-~index); });
});
@moriiimo
moriiimo / gist:5381787
Last active December 16, 2015 05:08
// 100をfor, whileを使わないでconsole.logで出力する。 : level7 - 数値を使ってはいけません
$(function(){
new Array(Number([~~true, ~~false, ~~false].join(""))).toString().split(",").filter(function(val, index){ console.log(-~index); });
});
@moriiimo
moriiimo / gist:5381729
Last active December 16, 2015 05:08
100をfor, whileを使わないでconsole.logで出力する。:level3 - if文、三項演算子を使ってはいけません
$(function(){
var num = 0;
baseAry.forEach(function(index){
num += 1;
console.log(num);
});
});
@moriiimo
moriiimo / gist:5381719
Last active December 16, 2015 05:08
100をfor, whileを使わないでconsole.logで出力する。: level5 - ワンライナーで書きなさい, level6 - +(プラス)演算子を使ってはいけません
$(function(){
new Array(100).toString().split(",").filter(function(val, index){ console.log(-~index); });
});
@moriiimo
moriiimo / gist:5352694
Last active December 16, 2015 01:09
100をfor, whileを使わないでconsole.logで出力する。: level2 - for文、while文を使ってはいけません
$(function () {
// 出力用配列
var tmpAry = new Array(100);
var tmpAryString = tmpAry.toString();
var aryString = tmpAryString.replace(/\,/g, "a@");
var baseAry = aryString.split("@");
// level1, level2: 再帰呼び出し
var recursive = function() {
function inner(a, b) {