Skip to content

Instantly share code, notes, and snippets.

@kioku-systemk
kioku-systemk / myclass.js
Last active June 21, 2017 07:11
js module definition
// UMD (Universal Module Definition)
(function(global, factory, name) {
if (typeof define === 'function' && define.amd) { define([], factory); /* AMD*/ }
else if (typeof exports === 'object') { module.exports = factory(); /* CommonJS */ }
else { global[name] = factory(); /* Global*/ }
})(this, function() {
'use strict';
var MyClass = {
hoge: function () {
@kioku-systemk
kioku-systemk / inlineshader.html
Created March 7, 2015 16:09
inline GLSL shader
<html><body></body><script>
(function(){
var c = document.createElement("canvas");
document.body.appendChild(c);
c.setAttribute("style", "position:absolute;left:0px;top:0px");
var g = c.getContext("webgl")||c.getContext("experimental-webgl");
if (!g) {
alert("This demo requires WebGL");
return;
}
@kioku-systemk
kioku-systemk / index.html
Last active August 29, 2015 14:10
Node.jsでHTMLを書き始めるテンプレ
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title></title>
</head>
<body>
</body>
</html>
@kioku-systemk
kioku-systemk / index.html
Created September 23, 2014 17:30
Interactive WebGL aobench
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title>WebGL aobench</title>
<!--
aobench project : https://code.google.com/p/aobench/
original GLSL version http://kioku.sys-k.net/4kgfxmon/
based on ported WebGL version by h013 : http://glsl.heroku.com/e#3159.0
@kioku-systemk
kioku-systemk / gist:9996943
Created April 5, 2014 19:32
Generate Wave sample
<p><script>(function(){
/*
Generate Wave sample
*/
var time = 1.0, // 1[sec]
sampling = 44100, // Samples per second
chan = 2,
waveLen = time * sampling * chan;
function genWave(buf)
@kioku-systemk
kioku-systemk / gist:9994703
Last active August 29, 2015 13:58
GLSL Viewer
<p><script>(function(){
/*
GLSL standalone viewer
sample from -> http://glsl.heroku.com/e#15472.1
*/
var shader="precision highp float;"
+"uniform float time;uniform vec2 resolution;float M(vec3 p){float r=cos(sin(p.x)"
+")+cos(p.y)+cos(sin(p.z));p*=25.;return r-=cos(cos(p.x)+cos(p.y)+cos(p.z))*.12;}"
+"void main(){float k=time,q=k,f=exp(1.-fract(k+sin(k))),t=0.,dt=5.;vec3 p=vec3(0"
+",-k*2.-f*f,0),d=normalize(vec3(-1.+2.*(gl_FragCoord.xy/resolution),1.));d/=64.;"
@kioku-systemk
kioku-systemk / thetashot.js
Created November 29, 2013 19:44
RICOH THETAでシャッターを切るサンプル(node.js版)
/*
RICOH THETA remote shutter for node.js
coded by @kioku_systemk
code license is public domain.
this code is referenced from @MobileHackerz and @GOROman
https://gist.github.com/GOROman/7596186
*/
var net = require('net');
@kioku-systemk
kioku-systemk / filebrowser.js
Created October 16, 2013 14:02
File Browser by express + node.js
var express = require('express');
var app = express();
app.use(express.static('/'));
app.use(express.directory('/'));
app.listen(8080);