Skip to content

Instantly share code, notes, and snippets.

Steve J Donovan stevedonovan

Block or report user

Report or block stevedonovan

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 lapp.nim
import strutils
from os import ParamCount, ParamStr
import tables
export tables.`[]`
#### Simple string lexer ###
PLexer = ref TLexer
TLexer = object
str: string
stevedonovan / head.nim
Created Sep 2, 2013
A simple implementation of `head` in Nimrod
View head.nim
import parseopt
from strutils import parseInt
from os import existsFile
const usage = """
head [flags] filename
-n: number of lines (default 10)
-h,--help: this help
-v,--version: version
stevedonovan / List.moon
Created Aug 10, 2013
A Moonscript class, documentation by LDoc,
View List.moon
-- A list class that wraps a table
-- @classmod List
import insert,concat,remove from table
class List
--- constructor passed a table `t`, which can be `nil`.
new: (t) =>
@ls = t or {}
stevedonovan / klass.moon
Created Aug 10, 2013
Alternative simple implementation of classes for Moonscript. This version is compatible with Lua classes created by Moonlight and Penlight.
View klass.moon
ctor = (C,...) ->
obj = setmetatable {}, C
init = rawget C, '_init'
if init
return obj
is_class = (C) ->
mt = getmetatable C
if mt and C._class -- this is a base class!
stevedonovan / lint64.c
Last active May 18, 2016
An int64 module, for Lua 5.1/5,2, by Luiz Henrique de Figueiredo <>, as extended by Steve Donovan (
View lint64.c
* lint64.c
* int64 nummbers for Lua
* Luiz Henrique de Figueiredo <>
* Thu Aug 1 22:56:17 BRT 2013
* This code is hereby placed in the public domain.
* Modified by Stevedonovan, Aug 3.
* __pow is defined by integer second arg
* new can be passed a hex literal string
* tohex will return a int64 as a hex string
stevedonovan / ld-parse.lua
Last active Dec 15, 2015
LuaDist batteries manifest; all modules which are directly installable. Third field is either 'no', 'yes' or <version> if there exists a higher version in the repo. A start made with annotating these entries with tags.
View ld-parse.lua
local f ='info.txt')
local line = f:read()
local Q = '"'
local QC = '",'
--local tags = dofile 'tags.lua'
stevedonovan / form.moon
Created Jan 29, 2013
Simple Android Activity in MoonScript using AndroLua
View form.moon
require 'android'
require 'android.intents' -- needed for creating an email..
feedback_email = ''
_M =!
with _M
-- compare to this more standard implementation:
stevedonovan / globalsplus.lua
Last active Dec 11, 2015
An extended undefined variable checker for Lua 5.1 using bytecode analysis based on David Manura's globalplus.lua
View globalsplus.lua
-- globalsplus.lua
-- Like globals.lua in Lua 5.1.4 -- globalsplus.lua
-- Like globals.lua in Lua 5.1.4 but records fields in global tables too.
-- Probably works but not well tested. Could be extended even further.
-- usage: lua globalsplus.lua example.lua
-- D.Manura, 2010-07, public domain
-- See
stevedonovan / struct.lua
Created Nov 19, 2012
'Strict' Structs in Lua.
View struct.lua
-- struct.lua
--- defining a struct constructor ---
local function ordered_map (t)
local fields,keys = {},{}
for i,item in ipairs(t) do
local key,value = next(item)
fields[key] = value
keys[i] = key
stevedonovan / mockup.ltp
Created Oct 11, 2012
Penlight-style Lua template for HTML with JavaScript; note @ used as escape!
View mockup.ltp
<script src="/flot/jquery.min.js" type="text/javascript"></script>
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="/media/flot/excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="/flot/jquery.flot.min.js"></script>
<script language="javascript" type="text/javascript" src="/flot/jquery.flot.navigate.js"></script>
<style type="text/css">
.center { text-align:center; }
You can’t perform that action at this time.