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 http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
| <meta http-equiv="encoding" content="utf-8"> | |
| </head> | |
| <canvas id="canvas" width="1490" height="512" style="border:1px dashed"> | |
| CA canvas | |
| </canvas> | |
| <script type="text/javascript"> | |
| var canvas = document.getElementById("canvas"); |
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 canvas = document.getElementById("exercises"), | |
| context = canvas.getContext("2d"), | |
| width = canvas.width, | |
| height = canvas.height; | |
| // midpoints | |
| var midX = canvas.width/2, midY = canvas.height/2; | |
| // trigonometry | |
| var TAU = Math.PI * 2, |
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="en"> | |
| <head> | |
| <title>-=( magic maths )=-</title> | |
| <link rel="stylesheet" href="" /> | |
| </head> | |
| <body bgcolor="#040404"> | |
| <canvas id="canvas" width=960 height=700> | |
| </canvas> | |
| <script src="magic_maths.js"></script> |
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
| console.log("hello"); | |
| function LazySeq(head, tail) { | |
| this.head = head; // value | |
| this.tail = tail; // thunk || null | |
| } | |
| function ints(n) { | |
| return new LazySeq(n, function() { return ints(n+1); }); | |
| } |
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
| (ns hs-js-clj.core) | |
| (def foo {:bar 1}) | |
| (defn fooify [n] (str "foo" n)) | |
| (defn commaify [[x y]] | |
| (str x ", " y)) |
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
| (define menu | |
| (lambda (x y) | |
| (conde | |
| [(== x 'tea) (== y 'biscuit)] | |
| [(== x 'coffee) (== y 'cookie)]))) | |
| (define conso | |
| (lambda (x y o) | |
| (== `(,x . ,y) o))) |
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
| $array = [] | |
| module Collatz | |
| def self.how_many n | |
| if n == 1 | |
| ($array.push n).length | |
| elsif n.even? | |
| $array.push n | |
| n = n / 2 | |
| how_many n |
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 Fixnum | |
| def ordinal | |
| %w[first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth][self - 1] | |
| end | |
| # Use #to_word rather than #to_s, so it doesn't break any other printing of numbers. | |
| def to_word | |
| %w[one two three four five six seven eight nine ten eleven twelve][self - 1] | |
| end | |
| end |
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
| # proccc | |
| def one proccc, x | |
| proccc.(x) | |
| end | |
| def two proccc, x | |
| proccc.(proccc.(x)) | |
| end |
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 palindrome? | |
| self == self.reverse | |
| end | |
| end | |
| class Integer | |
| def palindrome?(b=10) | |
| self.to_s(b).palindrome? | |
| end |