Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Radio button example</title>
</head>
<body>
<form id="form1">
<div>
<input type="radio" name="target" value="1" onchange="handler()">
@bathtimefish
bathtimefish / espruino-pico-puressure-sensor.js
Created October 30, 2017 06:09
Espruino Picoで圧力センサーの値を取得する
var i = setInterval(function() {
var val = analogRead(B1);
console.log(val); //圧力センサーの値
if(val < 0.5) { //値が0.5以下になるとLEDが点灯する
digitalWrite(A8, 1);
} else {
digitalWrite(A8, 0);
}
}, 100);
@bathtimefish
bathtimefish / dqn.py
Last active March 5, 2017 11:58
DQNをKerasとTensorFlowとOpenAI Gymで実装する https://elix-tech.github.io/ja/2016/06/29/dqn-ja.html のプログラムをPython3.5 & TensorFlow 1.0で動くように修正したやつ
# coding:utf-8
import os
import gym
import random
import numpy as np
import tensorflow as tf
from collections import deque
from skimage.color import rgb2gray
from skimage.transform import resize
@bathtimefish
bathtimefish / app.js
Created August 27, 2016 04:58
ChirimenでHTTPリクエストするサンプル
/**
*
* Chirimenに装着するWifiドングルは Planex GW-USNano2 動作確認済み
* https://www.planex.co.jp/product/wireless/gw-usnano2/
*
* WifiドングルをつけてChirimenを起動、SettingsでWifi設定を完了後、以下のソースを実行する
*
*/
window.addEventListener("load", function() {
@bathtimefish
bathtimefish / chirimen-motion-led-index.html
Created August 19, 2016 08:21
CHIRIMENで人感センサー検知LEDなサンプル
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
<title>Motion Sensor</title>
<!-- https://github.com/club-wot/WebGPIO -->
<script src="./bower_components/webgpio/dist/webgpio.js"></script>
<!-- https://github.com/mozilla/task.js/blob/master/lib/task.js -->
@bathtimefish
bathtimefish / promiseAllWait.html
Last active December 27, 2015 13:59
WHATWG PromiseのChrome実装を確認したページ。sleepっぽい処理を書いてみた。 http://dom.spec.whatwg.org/#promises
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style> body,input,button { font-size:1.8em; } </style>
</head>
<body>
<button id="start">Start</button>
<div id="monitor"></div>
<script>
@bathtimefish
bathtimefish / Gruntfile.js
Last active December 26, 2015 02:39
Yeoman generator-webapp で複数ページのJSでAMDを行う場合のbuild設定 - Gruntfile.js * 変更箇所はGruntfile.js の requirejs:dist1, dist2 , と uglify * yo 1.0.4 で動作確認
// Generated on 2013-10-21 using generator-webapp 0.4.3
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
@bathtimefish
bathtimefish / S3_CORS_Propatiy
Last active December 23, 2015 15:49
Direct Browser Uploading to Amazon S3 cf. http://goo.gl/PAB5Ou
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>http://www.example.com</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<AllowedHeader>Content-Type</AllowedHeader>
<AllowedHeader>x-amz-acl</AllowedHeader>
<AllowedHeader>origin</AllowedHeader>
</CORSRule>
<CORSRule>
@bathtimefish
bathtimefish / selection-pickup.html
Last active December 18, 2015 16:29
カーソル選択時に選択文字列をピックアップする
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>カーソル選択時に選択文字列をピックアップする</title>
</head>
<body>
<h1>The MIT License</h1>
<p>以下に定める条件に従い、本ソフトウェアおよび関連文書のファイル(以下「ソフトウェア」)の複製を取得するすべての人に対し、ソフトウェアを無制限に扱うことを無償で許可します。これには、ソフトウェアの複製を使用、複写、変更、結合、掲載、頒布、サブライセンス、および/または販売する権利、およびソフトウェアを提供する相手に同じことを許可する権利も無制限に含まれます。</p>
<p>上記の著作権表示および本許諾表示を、ソフトウェアのすべての複製または重要な部分に記載するものとします。</p>
@bathtimefish
bathtimefish / glassware-html-example
Last active December 18, 2015 04:49
Glassware用の実験のアレ
# うまくいった
<article>
<figure>
<img src="https://si0.twimg.com/profile_images/53494994/btf_logo.jpg" alt="example1 image">
</figure>
<section>
<h1>Example1. Hello</h1>
<p class="text-x-small">
<img src="https://mirror-api-playground.appspot.com/links/rated_r.png" alt="">
x-small text