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
l = [1, 1, 2, 2, 3] | |
distinct_result = list() | |
map(lambda x: not x in distinct_result and distinct_result.append(x), l) | |
print(distinct_result) | |
#[1, 2, 3] | |
distinct_result = list(set(l)) | |
print(distinct_result) | |
#[1, 2, 3] |
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
// 1つの場合 | |
function preloader() { | |
heavyImage = new Image(); | |
heavyImage.src = "sample.jpg"; | |
} | |
// 複数ある場合 | |
function preloader() { | |
// counter | |
var i = 0; |
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
# 整数を割り算すると、デフォルトで小数点以下が切り捨てになる | |
12 / 26 | |
#0 | |
float(12) / 26 | |
#0.46153846153846156 | |
12 * 1.0 / 26 | |
#0.46153846153846156 |
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); |
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 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
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
&: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
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
git branch -a | |
git branch -d branch-name | |
or | |
git branch -D branch-name | |
git push origin :branch-name |