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
# mockup of a game-oriented behavior modeling language, v1 (1/14/2012) | |
# copyright (c) 2012 darkf | |
playership <- Sprite(Vec2(64, 64)) # 64x64 sprite | |
enemyship <- Sprite(Vec2(64, 64)) | |
projectiles <- List() # dynamic list | |
on playership:collide b do | |
if b is? enemyship do | |
# collided with enemy ship |
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
This is the virtual machine for a pure OO language based on game creation. | |
It is, at essence, a stack machine. There are no registers. | |
Instructions only have one argument, which can be an integer or a string. | |
Function arguments are pushed in reverse order, C-style. (e.g. x(1,2,3) is 3 2 1 x on the stack) | |
Methods always have at least one argument -- "self", which is just the current object. | |
Instructions: | |
sys_init ; initialize system stuff |
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
class Color | |
{ | |
public var r : Int; | |
public var g : Int; | |
public var b : Int; | |
public function new(r=255, g=255, b=255) | |
{ | |
this.r = r; | |
this.g = g; |
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
html | |
body { | |
p "hi there" | |
h1 ":)" | |
} |
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
# copyright 2012 darkf | |
import sys;_,s,h=sys.argv;[open(x,'w').writelines([y for y in open(h)if x.strip()in y])for x in open(s)] |
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
(* Take a tree of expressions in and output the expression tree of the differentiation of it. (or something like that.) | |
Copyright (c) 2012 darkf | |
MIT license | |
*) | |
(* Assignment: http://pastebin.com/tiRVsxNx | |
Graphs: http://f.imgtmp.com/FOVY7.jpg | |
*) | |
type Node = |
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
# nanoshorten - a very tiny URL shortener Web application written in Bottle and sqlite | |
# copyright (c) 2012 darkf | |
# licensed under the WTFPL (WTF Public License) | |
# see http://sam.zoy.org/wtfpl/ for details | |
from bottle import get, request, run | |
import sqlite3, random, string | |
con = sqlite3.connect('short.db') | |
c = con.cursor() |
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 sys, os, glob, re, pickle | |
if len(sys.argv) != 2: | |
print "USAGE: %s DIR" % sys.argv[0] | |
sys.exit(1) | |
INDEX = {} | |
FILES = [] | |
for path,_,dirs in os.walk(sys.argv[1]): |
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
PC: | |
- 1024x768 VGA device; stored in memory from 0x00000000 to 0x00300000 (3,145,728 i.e. 1024x768 @ 32 bpp) | |
- BIOS using interrupt 0; has text rendering capabilities, among other things | |
RAM: | |
- Dynamically sized - default is 32mb | |
- Smallest addressable unit is the byte (8 bits) | |
- Address from VRAM's end to the next 16mb is stack space | |
- Memory from stack's end to the next 4096 bytes is reserved for the ROM (e.g. bootloader) | |
- Rest of address space is contiguous |
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
module Prog | |
type Node = Call of string * Node * Node | |
| Str of string | |
| Int of int | |
| Binop of string * Node * Node | |
type Type = FunType of Type * Type | |
| StrType | |
| IntType |