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
<?php | |
//Generate Encoded Polyline Algorithm Format for Google Static Maps API | |
// http://bit.ly/sw3deL (Japanese) | |
// http://bit.ly/tnKt4m (English) | |
function encodeGPolyline($path){ | |
$enc = ""; | |
$old = true; | |
foreach($path as $latlng){ | |
if($old === true){ |
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
<?php | |
# GitHubGist MediaWiki extension v.1 | |
# Author: Shohei Yokoyama (Shizuoka Univ. Japan) | |
# | |
#-Install | |
# 1. Save this code as $MediaWikiRoot/extensions/Gist.php | |
# 2. Append "require_once "$IP/extensions/Gist.php";" to LocalSetting.php | |
# | |
#-Usage | |
# Tag : |
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
#!/usr/local/bin/node | |
var conn = []; | |
// https://github.com/Worlize/WebSocket-Node/wiki/Documentation | |
var WebSocketServer = require('websocket').server; | |
var http = require('http'); | |
var originIsAllowed = function(){return true;} | |
var server = http.createServer(function(request, response) { | |
console.log((new Date()) + " Received request for " + request.url); | |
response.writeHead(404); | |
response.end(); |
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> | |
<head> | |
<title>node-websocket-server test</title> | |
</head> | |
<body> | |
<div><input id="msg" type="textfield"/><a href="#" id="send">Send</a></div> | |
<div id="log"></div> | |
<script type="text/javascript"> | |
var host = "foo.bar.com";// Your WebSocket Server |
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
//============================================================================ | |
// Name : flann-knn-example.cpp | |
// Author : Shohei Yokoyama | |
// Copyright : Shizuoka University, Japan | |
// Description : 1st step of your FLANN application. | |
// Dependency : FLANN http://people.cs.ubc.ca/~mariusm/index.php/FLANN/FLANN | |
// : Boost http://www.boost.org/ | |
// : (If win) MinGW & MSYS http://www.mingw.org/ | |
// License : NYSL see http://www.kmonos.net/nysl/index.en.html | |
//============================================================================ |
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
# for all files | |
find . -type f -print | xargs chmod 644 | |
# for all firectories | |
find . -type d -print | xargs chmod 755 |
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
private void canvas1_MouseMove(object sender, MouseEventArgs e) | |
{ | |
//マウスが青い四角領域(canvas1)上で動く度に呼び出されるメソッド | |
double x = e.GetPosition(canvas1).X; //canvas1の左上をゼロとした座標 | |
double y = e.GetPosition(canvas1).Y; | |
// カンマで区切ったマウスのxy座標を送信 | |
sendMessage(x + "," + y); | |
} |
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
//メッセージはココで受信 | |
//チャンネル削除 | |
msg = msg.substring(msg.indexOf(":")+1); | |
//カンマで分けて配列へ | |
fields = msg.split(","); | |
//注:サーバから来たデータは文字列として扱われているため、 | |
//数値を送った場合使用時はparseInt等で数値化する。 | |
if(X > -1){ | |
ctx.strokeStyle = 'rgb(254, 254, 254)'; | |
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
private void canvas1_MouseDown(object sender, MouseButtonEventArgs e) | |
{ | |
} |
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
//メッセージはココで受信 | |
//チャンネル削除 | |
msg = msg.substring(msg.indexOf(":")+1); | |
//カンマで分けて配列へ | |
var fields = msg.split(","); | |
//配列最初の要素はコマンド名なので取り出します。 | |
var cmd = fields.shift(); | |
//コマンドに応じて処理を切り替えます。 | |
switch(cmd){ | |
case "mouse": |
OlderNewer