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
/** | |
* cybozu-connect for Node | |
*/ | |
var jsdom = require('jsdom'), | |
XMLHttpRequest = require('XMLHttpRequest').XMLHttpRequest; | |
var document, | |
window, | |
$, | |
CBLabs = {}, |
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
Modern Style Spent: 896 ms | |
Primitive Style Spent: 766 ms |
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() { | |
var cardsNum = document.querySelectorAll('.card').length; | |
for (var i=0; i<cardsNum; i++) { | |
for (var j=i+1; j<cardsNum; j++) { | |
flip(i); | |
flip(j); | |
} | |
} | |
function flip(idx) { |
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 socket = null; | |
function bootstrap() { | |
// 適当な図形を描画 | |
var c = document.getElementById('mycanvas'); | |
var ctx = c.getContext('2d'); | |
ctx.globalalpha = 0.3; | |
for(var i=0; i<1000; i++) { | |
ctx.beginPath(); |
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
#include "testApp.h" | |
#include <iostream> | |
#include <XnCppWrapper.h> | |
#define MAX_DEPTH 10000 | |
void errorCheck(XnStatus status) { | |
if (status != XN_STATUS_OK) { |
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
/** | |
* Enable route to __noSuchMethod__ when unknown method calling. | |
* | |
* @param {Object} obj Target object. | |
* @return {Object} | |
*/ | |
function enableMethodMissing(obj) { | |
var functionHandler = createBaseHandler({}); | |
functionHandler.get = function(receiver, name) { |
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
" viとの互換性をOFF | |
set nocompatible | |
" エンコーディング設定 | |
set enc=utf-8 | |
set fencs=iso-2022-jp,euc-jp,cp932,utf-8 | |
set ambiwidth=double | |
" 検索機能の設定 | |
set ignorecase |
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.BufferedInputStream; | |
import java.io.IOException; | |
import java.net.HttpURLConnection; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import com.sun.jna.Pointer; | |
import com.sun.jna.ptr.*; | |
import org.json.JSONArray; |
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
module.exports = function urlFetch(urlString, callback) { | |
var url = require('url').parse(urlString); | |
var module = url.protocol === 'https:' ? require('https') : require('http'); | |
require('http').get({ | |
host: url.hostname, | |
port: url.port, | |
path: url.path | |
}, function(res) { | |
var body = ''; | |
res.on('data', function(chunk) { |
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
;; Newton法の手続きを繰り返す手続き | |
(define (curt-iter guess x) | |
(if (good-enough? guess x) | |
guess | |
(curt-iter (improve guess x) | |
x))) | |
;; 近似を得る手続き | |
(define (improve guess x) | |
(/ (+ (* 2 guess) |