This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String.prototype.tr = function (search, replace) { | |
| var pattern = new RegExp('[' + search + ']', 'g'); | |
| return this.replace(pattern, function (m) { | |
| return replace[search.indexOf(m)] || ''; | |
| }); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Kemuri = (function () { | |
| function Kemuri(source) { | |
| if (!(this instanceof Kemuri)) { | |
| return new Kemuri(source); | |
| } | |
| this.source = source || ''; | |
| this.stack = []; | |
| this.at = 0 | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html lang="ja"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Wireworld</title> | |
| <style> | |
| body { | |
| font-family: Helvetica, Arial, sans-serif; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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++]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # # | |
| # # | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Conway's Game of Life</title> | |
| </head> | |
| <body> | |
| <script src="life.js"></script> | |
| </body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var HQ9Plus; | |
| (function () { | |
| HQ9Plus = function HQ9Plus(code) { | |
| if (!(this instanceof HQ9Plus)) { | |
| return new HQ9Plus(code); | |
| } | |
| this._code = code || ''; | |
| }; |