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
javascript:(function(){var u='//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery-1.8.0.min.js',d=document,s=d.createElement('script');s.setAttribute('src',u);d.getElementsByTagName('body')[0].appendChild(s);})() |
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
<!DOCTYPE HTML> | |
<html lang="jp"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<script type="text/javascript"> | |
window.onload=function(){ | |
var elm = document.getElementById("exec"); | |
elm.addEventListener("click", function (e) { | |
var log = document.getElementById("log"); |
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
// from JavaScript Good Parts | |
Function.prototype.curry = function(){ | |
var slice = Array.prototype.slice, | |
args = slice.apply(arguments), | |
that = this; | |
return function(){ | |
return that.apply(null, args.concat(slice.apply(arguments))); | |
}; | |
}; |
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 i = 1; | |
// +1 される前の値が出力されるのが i++ | |
console.log(i++) // 1 | |
// そして次に呼び出すときには +1 されている | |
console.log(i) // 2 | |
var j = 1; | |
// +1 された後の値が出力されるのが ++j | |
console.log(++j) // 2 | |
console.log(j) // 2 |
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
font-family: 'PT Sans', sans-serif; | |
font-family: 'Petrona', serif; | |
font-family: 'Marcellus', serif; | |
font-family: 'Galdeano', sans-serif; | |
font-family: 'Ruluko', sans-serif; | |
font-family: 'Rosario', sans-serif; | |
font-family: 'Asul', sans-serif; | |
font-family: 'Belleza', sans-serif; | |
font-family: 'Merriweather', serif; |
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
# こんな感じのコードが | |
ary = (1..100).to_a | |
while ary.size != 0 | |
p ary.slice!(0,15) | |
end | |
# こんな感じに書ける。 | |
(1..100).to_a.each_slice(15){|a| p 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
// (1..100).to_a.each_slice(15){|a| p a} を Java で書いてみたらこんなんになっちゃったんだけど。 | |
// これは僕のJava力が低下し過ぎているせいか…? | |
// この書き方だとListでも配列でもあんまりかわんない。 | |
// なんか、自分の書き方が間違ってる気がすごくするけど、かっこいいコードが思いつかなかった。 | |
import java.util.List; | |
import java.util.ArrayList; | |
public class A{ | |
public static void main(String args[]){ | |
List<Integer> ary = new ArrayList<Integer>(); |
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
<%- # 空行が表示されない(rails) -%> | |
<% # 空行が表示される(rails) %> |
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 ws = require("websocket.io"); | |
var server = ws.listen(8888, | |
function () { | |
console.log("ws start"); | |
} | |
); | |
server.on("connection", | |
function(socket) { | |
socket.on("message", |
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
import java.io.IOException; | |
import java.util.Collections; | |
import java.util.HashSet; | |
import java.util.Set; | |
import javax.websocket.Session; | |
import javax.websocket.WebSocketClose; | |
import javax.websocket.WebSocketEndpoint; | |
import javax.websocket.WebSocketMessage; | |
import javax.websocket.WebSocketOpen; |
OlderNewer