Skip to content

Instantly share code, notes, and snippets.

View usagi's full-sized avatar
🍣
Sushi

USAGI/USAGI.NETWORK usagi

🍣
Sushi
View GitHub Profile
@usagi
usagi / simulation-for-node.js
Created June 5, 2012 15:45
バグ報告用サンプル
var typeTargets = new Array(//問題配列
"STRAWBERRY", "ORANGE","CHERRY","BANANA"
);
function next() {
var index = Math.round(Math.random() * (typeTargets.length - 1));//問題数分の乱数生成
return typeTargets[index]; //問題配列[乱数]
}
// ↑ここまでは
var http = require('http'),
url = require('url'),
path = require('path'),
fs = require('fs'),
var port_local = 8080;
var load_static_file = function(uri, response) {
// 相対パスで静的リソースを配信する。
var tmp = uri.split('.');
var http = require('http');
var fs = require('fs');
var index = fs.readFileSync('index.html');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end(index);
}).listen(9615);
var http = require("http");
var fs = require("fs");
var path = require("path");
http.createServer
( function(request, response)
{ var filename = request.url.substr(1);
if (path.existsSync(filename))
{ response.writeHead
( 200
@usagi
usagi / test.html
Created July 10, 2012 05:18
AJAX; simple sample
<!DOCTYPE html>
<script src="test.js"></script>
Array.prototype.shuffle = function() {
var i = this.length;
while(i){
var j = Math.floor(Math.random()*i);
var t = this[--i];
this[i] = this[j];
this[j] = t;
}
return this;
}
@usagi
usagi / hoge.html
Created November 1, 2012 02:41 — forked from anonymous/gist:3991164
JS sample for Mr. S
<!DOCTYPE HTML>
<html>
<head>
<script>
var mybutton=function(name_,x_,y_){
this.name = name_;
this.x = x_;
this.y = y_;
this.radius = 10;
this.time = 0;
@usagi
usagi / trigraph_sample.cxx
Created November 26, 2012 07:29
trigraph sample
??=include <iostream>
int main()??<
unsigned a??(??)=??<1,2,3??>;
std::cout<<??-((a??(0??)??!a??(1??))-a??(2??));
??>
#include <boost/multi_array.hpp>
#include <algorithm>
#include <random>
#include <iostream>
int main(){
using value_type = size_t;
const size_t dimension = 3;
using c = boost::multi_array<value_type, dimension>;
@usagi
usagi / そうだ、Fedora17KDEを入れよう・x・.md
Last active June 21, 2018 06:40
『そうだ、Fedora17KDEを入れよう・x・』 ある日のうさぎせんせいのFedoraメモ。もしかしたらこそこそ更新するかも。 はじめてのFedoraでC++環境を整えて素敵な開発ライフを楽しもうかな、そんな事をなぜかふわりと思っているとあるIT系女子へのヒント。