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
// クロスドメインの http://hoge.com/test.cgi からJSONPを取得 | |
var hoge = function(data) { | |
alert("key1:" + data.key1); | |
alert("key2:" + data.key2); | |
} | |
var script = document.createElement('script'); | |
script.src = 'http://hoge.com/test.cgi?callback=hoge'; | |
document.head.appendChild(script); |
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
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> |
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
// クロスドメインの http://hoge.com/test.cgi からJSONPを取得 (再掲) | |
$.getJSON("http://hoge.com/test.cgi?callback=?", | |
function(data){ | |
alert("key1:" + data.key1); | |
alert("key2:" + data.key2; | |
} | |
); |
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
functionName({ "key1": "value1", "key2": "value2" }) |
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
<!DOCTYPE html> | |
<title>Boids Simulation</title> | |
<h1>Boids Simulation</h1> | |
<canvas id="canvas" width="640" height="480"></canvas> | |
<style> | |
/** | |
* html body に設定される自然な | |
* margin padding を除去する | |
*/ | |
html, body { |
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
<!DOCTYPE html> | |
<meta charset="UTF-8"> | |
<title>Boids Sims.</title> | |
<h1>Boids Sims.</h1> | |
<ul> | |
<li>ブラウザ上の画面をクリックして、<b>青い丸(えさ)</b>の位置を変えます。</li> | |
<li><b>赤い丸(ボイド)</b>が<b>えさ</b>に群がります。</li> | |
<li><b>ボイド</b>が<b>緑色の丸(敵)</b>にぶつかると消えてしまいます。</li> | |
<li>すべて消えてしまうと<b>ゲームオーバー</b>。ゲームが続いた時間が長ければ長いほど高いスコアになります。</li> | |
<li>えさでうまく誘導してボイドの群れを生き延びさせましょう!</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
int analogPin = 0; | |
int pwm_a = 3; //PWM control for motor outputs 1 and 2 is on digital pin 3 | |
int pwm_b = 11; //PWM control for motor outputs 3 and 4 is on digital pin 11 | |
int dir_a = 12; //direction control for motor outputs 1 and 2 is on digital pin 12 | |
int dir_b = 13; //direction control for motor outputs 3 and 4 is on digital pin 13 | |
int val = 0; //value for fade | |
int v = 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
# coding: utf-8 | |
require 'opencv' | |
require 'fileutils' | |
dropbox_dir = "/path/to/Dropbox" # ここだけ自分用に書き換えてください | |
# 0 番だと Mac のインカメラが選択されてしまうので 1 番を選択 | |
capture = OpenCV::CvCapture.open 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
require 'benchmark' | |
_MAXNUM=1000 | |
#=begin | |
# 二項係数 nCk を計算する関数 ver.1 | |
def binom_v1(n,k) | |
if k==0 then | |
return 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
# 正定値二次形式の類を列挙するプログラム | |
# created by Junpei Tsuji <http://tsujimotter.info> | |
require 'prime' | |
require 'set' | |
# a, b, c を係数とする二次形式 f(x, y) = ax^2 + bxy + cy^2 を表すクラス | |
class QuadraticForm | |
def initialize a,b,c | |
@a = a |