Skip to content

Instantly share code, notes, and snippets.

Todd Sundsted toddsundsted

  • New York
Block or report user

Report or block toddsundsted

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:b6ab0bfe693ae13056d6
type Peg = String
type Move = (Peg, Peg)
move :: Integer -> Peg -> Peg -> Peg -> [Move]
move 0 _ _ _ = []
move 1 from to _ = [(from,to)]
move n from to temp = move (n - 1) from temp to ++ [(from,to)] ++ move (n - 1) temp to from
hanoi :: Integer -> Peg -> Peg -> Peg -> [Move]
hanoi n a b c = move n a c b
View moocode_toolkit.moo
;; while (read(player) != ".") endwhile
I M P O R T A N T
=================
The following code cannot be used as is. You will need to rewrite
functionality that is not present in your server/core. The most
straight-forward target (other than Stunt/Improvise) is a server/core
that provides a map datatype and anonymous objects.
@toddsundsted
toddsundsted / gist:1616304
Created Jan 15, 2012
PLEAC: File Access (Scala)
View gist:1616304
/* File Access
* see http://pleac.sourceforge.net/pleac_perl/fileaccess.html
* Scala 2.9.1
*/
import scripting.file._
import scripting.file.Implicits._
/* Introduction */
@toddsundsted
toddsundsted / gist:1613243
Created Jan 14, 2012
PLEAC: Process Management and Communication (Scala)
View gist:1613243
/* Process Management and Communication
* see http://pleac.sourceforge.net/pleac_perl/processmanagementetc.html
* Scala 2.9.1
*/
import scala.sys.process._
import scala.io.Source
import java.io.File
/* Gathering Output From a Program */
@toddsundsted
toddsundsted / gist:1505615
Created Dec 21, 2011
Creating a Running Application Inside the Play Console
View gist:1505615
import play.core._
import play.api._
import play.api.mvc._
import java.io._
import play.api.Play.current
val app = Application(new File("."), new ApplicationClassLoader(this.getClass.getClassLoader), None, Play.Mode.Dev)
@toddsundsted
toddsundsted / composed.moo
Created Dec 3, 2011
LambdaCore Compatible Dump of Composed
View composed.moo
; create($nothing)
@prop #102."packages" 0 ""
@prop #102."provides_cache" 0 ""
@prop #102."requires_cache" 0 ""
@prop #102."last_fetch_index" 0 ""
@prop #102."archived" 0 ""
@prop #102."cached" 0 ""
@prop #102."archive_host" "207.210.101.162" ""
@prop #102."archive_port" 80 ""
@toddsundsted
toddsundsted / shapes.moo
Created Dec 3, 2011
LambdaCore Compatible Dump of Shapes
View shapes.moo
; create($nothing)
@verb #101:"_log" this none this xd
@program #101:_log
notify(player, tostr(@args));
.
@verb #101:"_suspend_if_necessary" this none this xd
@program #101:_suspend_if_necessary
ticks_left() < 10000 || seconds_left() < 2 && suspend(0);
@toddsundsted
toddsundsted / gist:1398354
Created Nov 27, 2011
Dump of the Objects in the Primitive Package
View gist:1398354
@create $nothing named Primitive Package:
@prop #34299."identifier" "primitive" r
@prop #34299."version" "0.0.1" r
@prop #34299."manifest" {} r
;;#34299.("manifest") = {{#34299, "package"}, {#34300, "dictionary"}, {#34303, "int_proto"}, {#34304, "float_proto"}, {#34306, "str_proto"}, {#34307, "err_proto"}, {#34308, "list_proto"}, {#34309, "map_proto"}, {#34310, "lambda_proto"}}
@prop #34299."relocate" {} r
;;#34299.("relocate") = {"dictionary.int_proto", "dictionary.float_proto", "dictionary.str_proto", "dictionary.err_proto", "dictionary.list_proto", "dictionary.map_proto", "dictionary.lambda_proto", "dictionary.frobs"}
@prop #34299."requires" {} r
;;#34299.("requires") = {{"kernel", ">= 1.0.4"}}
@prop #34299."instructions" {} r
View base64.patch
diff --git a/Makefile.in b/Makefile.in
index 76a351f..48c58a1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -29,13 +29,15 @@ CFLAGS = -O
YFLAGS = -d
COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
-CSRCS = ast.c code_gen.c db_file.c db_io.c db_objects.c db_properties.c \
- db_verbs.c decompile.c disassemble.c eval_env.c eval_vm.c \
@toddsundsted
toddsundsted / fileio-1.5p3.patch
Created Aug 5, 2011
FileIO v1.5p3 Patchfile
View fileio-1.5p3.patch
diff --git a/ChangeLog-fileio.txt b/ChangeLog-fileio.txt
new file mode 100644
index 0000000..9596740
--- /dev/null
+++ b/ChangeLog-fileio.txt
@@ -0,0 +1,29 @@
+Version 1.5p3 - Jul 11
+----------------------
+ - Added return value check on calls to binary_to_raw_bytes (via out_filter)
+ - Replaced use of fgets to better handle files with null bytes
You can’t perform that action at this time.