This gist has been deprecated: see sdldoctables
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
function chainfunc(...) | |
local chain={...} | |
return function(...) | |
local first = true | |
local a,b,c,d,e,f | |
for i,v in ipairs(chain) do | |
if first then | |
result = {v(...)} | |
first = false | |
else |
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
// Ported from Stefan Gustavson's java implementation | |
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf | |
// Read Stefan's excellent paper for details on how this code works. | |
// | |
// Sean McCullough banksean@gmail.com | |
/** | |
* You can pass in a random number generator object if you like. | |
* It is assumed to have a random() method. | |
*/ |
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
#include <stdio.h> | |
static int SEED = 0; | |
static int hash[] = {208,34,231,213,32,248,233,56,161,78,24,140,71,48,140,254,245,255,247,247,40, | |
185,248,251,245,28,124,204,204,76,36,1,107,28,234,163,202,224,245,128,167,204, | |
9,92,217,54,239,174,173,102,193,189,190,121,100,108,167,44,43,77,180,204,8,81, | |
70,223,11,38,24,254,210,210,177,32,81,195,243,125,8,169,112,32,97,53,195,13, | |
203,9,47,104,125,117,114,124,165,203,181,235,193,206,70,180,174,0,167,181,41, | |
164,30,116,127,198,245,146,87,224,149,206,57,4,192,210,65,210,129,240,178,105, |
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
(defpackage #:perlin | |
(:use #:cl) | |
(:export #:perlin2d | |
#:*seed*)) | |
(in-package #:perlin) | |
(declaim (optimize (speed 3) (safety 0) (debug 0))) | |
(defparameter *seed* 0) |
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
Die = { | |
roll = function(self) | |
self.value = math.random(self.sides) | |
end | |
} | |
Die["__index"] = Die | |
function D(sides, value) | |
local die = {sides = sides, value = value} | |
setmetatable(die, Die) |
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/local/Gambit-C/bin/gsi | |
; Copyright (C) 2004 by Marc Feeley, All Rights Reserved. | |
; This is the "90 minute Scheme to C compiler" presented at the | |
; Montreal Scheme/Lisp User Group on October 20, 2004. | |
; Usage with Gambit-C 4.0: | |
; | |
; % ./90-min-scc.scm test.scm |
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
-- Pack this into an object file with ld: ld -r -b binary -o hello.o hello.lua | |
print "Hello, World!" |
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
def removecomments(s): | |
inCommentSingle = False | |
inCommentMulti = False | |
inString = False | |
t = [] | |
l = len(s) | |
i = 0 | |
fromIndex = 0 |
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
function [numcycles,cycles] = find_elem_circuits(A) | |
if ~issparse(A) | |
A = sparse(A); | |
end | |
n = size(A,1); | |
Blist = cell(n,1); |
OlderNewer