This file contains 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
/** | |
* RGBA => HSVA & HSVA => RGBA Converter | |
* USAGE: | |
* var canvas = document.getElementById('canvas'); | |
* var ctx = canvas.getContext('2d'); | |
* ctx.fillStyle = (new HSVA(250, 0.5, 1.0, 1.0)).toRGBA().toString(); | |
* ctx.fillRect(0, 0, canvas.width, canvas.height); | |
* Author: VoQn | |
* Last Update: 2010/05/05 | |
*/ |
This file contains 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
<?xml version="1.0" encosing="UTF-8"?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml/DTD/xhtml1-transitinal.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8;" /> | |
<meta http-equiv="Content-Language" content="en" /> | |
<meta http-equiv="Content-Style-Type" content="text/css" /> | |
<meta http-equiv="Content-Script-Type" content="text/javascript" /> | |
<title>Hoge</title> |
This file contains 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
<?xml version="1.0" encosing="UTF-8"?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml/DTD/xhtml1-transitinal.dtd"> | |
<html xmlnx="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8;" /> | |
<meta http-equiv="Content-Language" content="en" /> | |
<meta http-equiv="Content-Style-Type" content="text/css" /> | |
<meta http-equiv="Content-Script-Type" content="text/javascript" /> | |
<title>Hoge</title> |
This file contains 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
;; -*- mode:scheme; coding:utf-8 -*- | |
;; 2.3.2 Derivation | |
(define (deriv exp var) | |
(cond ((number? exp) 0) | |
((variable? exp) | |
(if (same-variable? exp var) 1 0)) | |
((sum? exp) | |
(make-sum (deriv (addend exp) var) | |
(deriv (augend exp) var))) | |
((product? exp) |
This file contains 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
#!/opt/local/bin/gosh | |
;;; | |
;;; Source Code | |
;;; | |
;; Sequential T transform O(log(n)) | |
(define (fib-t n) | |
(let iter [(a 1) (b 0) (p 0) (q 1) (count n)] |
This file contains 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
;; Shortest? FizzBuzz | |
(use srfi-1) | |
(let1 ? (.$ zero? (pa$ mod)) | |
(for-each | |
(.$ print (^i (cond [(? i 15) 'FizzBuzz] | |
[(? i 5) 'Buzz] | |
[(? i 3) 'Fizz] | |
[else i]))) | |
(cdr (iota 101)))) |
This file contains 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
for i in range(1,101):print(i%3<1)*'Fizz'+(i%5<1)*'Buzz'or i |
This file contains 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
#! /usr/bin/env gosh | |
(use gl) | |
(use gl.glut) | |
;; Util Procedure | |
(define (assq-ref entry alist) | |
(cdr (assq entry alist))) | |
(define (slot-list obj getter-list) |
This file contains 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
leap :: Integral a => a -> Bool | |
leap y = let m = (== 0) . (mod y) in if m 100 then m 400 else m 4 | |
{- | |
leap 3 -- False | |
leap 4 -- True | |
leap 5 -- False | |
leap 96 -- True | |
leap 100 -- False | |
leap 104 -- True |
This file contains 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
import Test.HUnit | |
-- Target Function for Test | |
leap :: Integral a => a -> Bool | |
leap year = if d 100 then d 400 | |
else d 4 | |
where divisible = (== 0) . (mod year) | |
d = divisible | |
-- Test Method |