Skip to content

Instantly share code, notes, and snippets.

View UncleBill's full-sized avatar
😳
K.I.S.S

UncleBill

😳
K.I.S.S
View GitHub Profile
@k0f1sh
k0f1sh / zone-pgm-rainbow
Last active April 27, 2018 15:51
虹色zone
;; zone-pgm-rainbow
(defun decimal->hex (n)
(format "%02X" n))
(defun hsv->rgb (h s v)
(let ((h (max 0 (min 360 h)))
(s (/ (max 0 (min 100 s)) 100.0))
(v (/ (max 0 (min 100 v)) 100.0)))
(if (= 0 s)
@cowboy
cowboy / iife-variations.js
Created December 24, 2010 00:14
A few variations on writing an IIFE
// Want to learn more about Immediately Invoked Function Expressions? Read
// this article first:
//
// http://benalman.com/news/2010/11/immediately-invoked-function-expression/
// Parens are used to tell the parser that it's a function expression,
// not a function declaration. If you don't explicitly tell the parser to
// expect an expression, it will throw a SyntaxError exception because it
// sees a function declaration without a name specified.
@pekkaklarck
pekkaklarck / gist:6712255
Last active May 23, 2016 01:05
Javascript implementation of UTF-8 decoding algorithm by Björn Höhrmann explained at http://bjoern.hoehrmann.de/utf-8/decoder/dfa/. To support codepoints outside the Unicode BMP, this algorithm uses the custom String.fromCodePoint method explained at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromChar…
var UTF8_ACCEPT = 0;
var UTF8D = [
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8,
@Marak
Marak / 0-primeFactor.js
Last active October 12, 2015 03:58
Experimenting with new process.prevTick() API
//
// Calculating prime factors in polynomial time using node.js process.prevTick()
//
// see: http://en.wikipedia.org/wiki/Prime_factor
// see: http://en.wikipedia.org/wiki/Novikov_self-consistency_principle
//
// Authors:
// http://jesusabdullah.net/
// http://marak.com
//