This file contains hidden or 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 newCounter() { | |
| var i = 0; | |
| return function() { | |
| i = i + 1; | |
| return i; | |
| } | |
| } | |
| var c1 = newCounter(); | |
| var c2 = newCounter(); | |
| console.log(c1()); // 1 |
This file contains hidden or 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 total = 0, | |
| num = 0, | |
| ave, | |
| i; | |
| for (i = 1; i <= 10; i++) { | |
| total += i; | |
| num++; | |
| } |
This file contains hidden or 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
| open -a Firefox | |
| open -a Safari | |
| open -a Google\ Chrome |
This file contains hidden or 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
| git branch -a | |
| git branch -d branch-name | |
| or | |
| git branch -D branch-name | |
| git push origin :branch-name |
This file contains hidden or 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
| unko = setTimeout -> | |
| console.log("ok") | |
| , 1000 |
This file contains hidden or 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
| &:after{ | |
| content:''; | |
| display: block; | |
| @include position(absolute, null null 0px 0px); | |
| width: 100%; | |
| height: 60px; | |
| @include background(linear-gradient(rgba(#fff,0), rgba(#fff,1))); | |
| } |
This file contains hidden or 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 obj = { | |
| "uri": "http://example.com/", | |
| "title": "title", | |
| "author": "hogenishi", | |
| "x": 20, | |
| "y": 65, | |
| "width": 200, | |
| "height": 150, | |
| "version": 0.1.1 | |
| }; |
This file contains hidden or 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 list = document.getElementById("list"); | |
| list.addEventListener("click", function(e) { | |
| if (e.target.tagName == "LI") { | |
| e.target.style.color = "#f00"; | |
| return false; | |
| } | |
| }, false); | |
| list.innerHTML = "<li>test</li>"; |
This file contains hidden or 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 Item() { | |
| this.initialize.apply(this, arguments); | |
| } | |
| Item.prototype = { | |
| initialize: function(price) { | |
| this.price = price; | |
| }, | |
| showPrice: function() { | |
| alert(this.price); | |
| } |
This file contains hidden or 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 Item = (function () { | |
| function Item(price) { | |
| this.price = price; | |
| } | |
| Item.prototype.showPrice = function () { | |
| alert(this.price); | |
| }; | |
| return Item; | |
| })(); | |
| var i = new Item(200); |