Skip to content

Instantly share code, notes, and snippets.

@think49
think49 / calculator.css
Last active November 11, 2016 05:47
calculator.js: 計算式を表示するシンプルな電卓
/**
* calculator.css
*/
.calc-form {
border-collapse: separate;
border-spacing: 0.2em;
font-style: monospace;
}
@think49
think49 / [html,css,javascript]-idname&classname-specification.md
Last active June 2, 2022 07:22
[HTML, CSS, JavaScript] id名/class名に使用できる文字の種類
@think49
think49 / eval-calculation-1.0.0.js
Last active October 18, 2023 15:04
eval-calculation.js: 計算式の文字列を評価する
/**
* eval-calculation.js
* evaluate calculation formula.
*
* @version 1.0.0
* @author think49
* @url https://gist.github.com/think49/54b074cab2145efddb48765652c74710
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/
@think49
think49 / eval-calculation-map-sample.html
Last active November 13, 2016 15:10
eval-calculation-map-sample: Chironian さんのアドバイスを元に書いてみたコード。new Map(['value', '演算結果となる数値'], ['errors', [new SyntaxError('エラー1'), new SyntaxError('エラー2')]]) を返り値とする。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>eval-calculation-map-sample.js</title>
<script>
/**
* eval-calculation-map-sample.js
* evaluate calculation formula.
*
@think49
think49 / calculation-sample.html
Last active November 13, 2016 15:53
calculation-sample.js: LLmanさんのアドバイスを元に書いたコード。SyntaxErrorのエラー検出処理と数値演算処理を別関数に分割した。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>calculation-sample.js</title>
<script>
/**
* calculation-sample.js
* evaluate calculation formula.
*
@think49
think49 / array-findwordall.js
Last active January 31, 2017 17:53
array-findwordall.js: 配列から指定した文字列リスト全てを含む要素を抽出します (要ES5)
/**
* array-findwordall.js
*
* @version 1.0.0
* @author think49
* @url https://gist.github.com/think49/811ac93dae801a4cec2e58a70a9b961a
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/
var findWordAll = (function (RegExp, call, test, replace) {
@think49
think49 / find-corresponding-from-string.js
Last active May 2, 2021 07:23
find-corresponding-from-string.js: 「開始文字列」と「終了文字列」で括られた対応関係を最長一致でマッチします。
/**
* find-corresponding-from-string.js
*
* @version 1.0.0
* @author think49
* @url https://gist.github.com/think49/53b4a2cedfcff3c1a1ea40390a7ff3d8
* @license http://www.opensource.org/licenses/mit-license.php (The MIT License)
*/
'use strict';
@think49
think49 / readme.md
Last active June 21, 2017 01:45
swap-node.js: 2つのノードの位置を入れ替えます

swap-node.js

概要

2つのノードの位置を入れ替えます。

制約

内部的に Node#replaceChild, Node#appendChild, Node#insertBefore を使用している関係上、下記制約があります。

@think49
think49 / create-qa-form.html
Last active July 12, 2017 11:38
出題フォームを生成する (URL Standard)
<!DOCTYPE html>
<html id="root">
<head>
<meta charset="UTF-8">
<title>出題フォームを生成する</title>
<body>
<h1>出題フォームを生成する</h1>
<h2>実装</h2>
@think49
think49 / readme.md
Last active July 13, 2017 14:05
virtual-dom.js: DOM API互換の Interface で仮想DOMオブジェクトを生成する

virtual-dom.js

概要

DOM API互換の Interface で仮想DOMオブジェクトを生成する。

使い方

p要素ノードを生成し、id属性値を付与する。