Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View st98's full-sized avatar

st98 st98

View GitHub Profile
@st98
st98 / kaomoji.fs
Last active August 29, 2015 13:56
これは流行る。
(*´ω`*)
@st98
st98 / hq9plus.js
Last active August 29, 2015 13:56
HQ9+のインタプリタ。
var HQ9Plus;
(function () {
HQ9Plus = function HQ9Plus(code) {
if (!(this instanceof HQ9Plus)) {
return new HQ9Plus(code);
}
this._code = code || '';
};
@st98
st98 / life.html
Last active August 29, 2015 13:56
JavaScriptで書いたライフゲーム。
<!doctype html>
<head>
<meta charset="utf-8">
<title>Conway&apos;s Game of Life</title>
</head>
<body>
<script src="life.js"></script>
</body>
@st98
st98 / svmmohmm.py
Created February 27, 2014 08:48
Python 3では動きません。
# coding: rot13
qrs svmm_ohmm(a):
sbe k va enatr(1, a + 1):
vs k % 15 == 0:
cevag "FizzBuzz"
ryvs k % 3 == 0:
cevag "Fizz"
ryvs k % 5 == 0:
cevag "Buzz"
ryfr:
@st98
st98 / rule-18
Last active August 29, 2015 13:56
#
# #
# #
@st98
st98 / elementary-cellular-automaton.rb
Created March 1, 2014 18:39
Rubyの練習。一次元セルオートマトン。
class String
def zfill(width)
self.rjust(width, '0')
end
end
class ElementaryCellularAutomaton
attr_reader :rule, :width, :cells
def initialize(rule = rand(256), width = 75)
@st98
st98 / to-whitespace.js
Created March 3, 2014 05:54
54 => " \t\t \t\t \n", -54 => "\t\t\t \t\t \n"
var toWhitespace = function (n) {
var result = '';
var table = {
0: ' ',
1: '\t'
};
result += (n < 0) ? table[1] : table[0];
result += Math.abs(n).toString(2).replace(/[01]/g, function (m) {
@st98
st98 / format.js
Last active August 29, 2015 13:57
Pythonのstr#formatもどき。
(function () {
var slice = [].slice;
String.prototype.format = function (/* ...args */) {
var args = slice.call(arguments);
var count = 0;
return this.replace(/{(\d+)?}/g, function (m, n) {
if (typeof n === 'undefined') {
return args[count++];
@st98
st98 / main.html
Last active August 29, 2015 13:57
ワイヤワールドというセルオートマトンを実装してみました。
<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>Wireworld</title>
<style>
body {
font-family: Helvetica, Arial, sans-serif;
}
@st98
st98 / KEMURI.js
Last active August 29, 2015 13:57
JavaScriptでKEMURI処理系。 参考: http://www.nishiohirokazu.org/blog/2006/09/kemuri.html
var Kemuri = (function () {
function Kemuri(source) {
if (!(this instanceof Kemuri)) {
return new Kemuri(source);
}
this.source = source || '';
this.stack = [];
this.at = 0
};