Skip to content

Instantly share code, notes, and snippets.

function skip15sec(){
var player = document.querySelector("audio");
player.currentTime = player.currentTime + 15;
}
function rewind15sec(){
var player = document.querySelector("audio");
player.currentTime = player.currentTime - 15;
}
function draw(){
ctx.fillStyle = "rgb(32, 32, 32)";
ctx.fillRect(0, 0, canvas.width, canvas.height);
var data = [20, 40, 50, 60, 30, 10, 20, 40, 70, 5, -1, -20, -5, -20, -7, -5, 5];
ctx.fillStyle = "rgb(255, 255, 255)";
var i = 0;
var offset = 5;
var width = (canvas.width - offset * (data.length + 1))/ data.length;
function getMinute(min, after){
return (min + after) % 60;
}
function getHour(hour, after){
return (hour + after) % 24;
}
@chikoski
chikoski / 01.js
Last active August 29, 2015 14:19
function add(a, b){
return a + b;
}
function subtract(a, b){
return a - b;
}
function multiply(a, b){
return a * b;
function addTwo(a){
b = a + 1;
return a + 1;
}
c = addTwo(1);
/*
2
*/
d = c + b;
function addOne(a){
return a + 1;
}
function addTwo(a){
var b = addOne(a);
return addOne(b);
}
addTwo(1);
function getData(url){
return new Promise((resolve, reject) => {
console.log("download " + url);
var req = new XMLHttpRequest({mozSystem: true});
req.open("GET", url, true);
req.overrideMimeType("audio/mp4");
req.responseType = "blob";
req.onload = () => {
console.log("downloaded");
resolve(req.response);
@chikoski
chikoski / aaa.js
Last active August 29, 2015 14:17
alert("gistからの刺客");
var div = $("<div></div>");
div.css({width: "100%", height: window.innerHeight + "px", position: "fixed", top: 0, left: 0});
div.appendTo($("body"));
@chikoski
chikoski / app.css
Created March 20, 2015 09:00
A sample Firefox app which captures and records audio through microphone.
body{
margin: 0;
padding: 0;
}
#canvas{
width: 100%;
height: 400px;
margin: 0;
padding: 0;
box-sizing: border-box;
@chikoski
chikoski / app.js
Last active August 29, 2015 14:16
GetUserMediaを使ったカメラアプリ
navigator.getUserMedia =
navigator.getUserMedia || navigator.mozGetUserMedia;
const SIZE = {
width: 800,
height: 600
};
var storage;
var elements;