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
@stevedonovan
stevedonovan / ChartExample.java
Last active Jan 7, 2019
Android Example using AChartEngine to plot JSON data
View ChartExample.java
package com.example.testchart;
import java.util.*;
import java.io.*;
import java.text.DateFormat;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.*;
@stevedonovan
stevedonovan / foo.c
Created May 25, 2012
A Lua script to embed Lua code in a C module.
View foo.c
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#ifdef WIN32
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
static const char * lua_code = \
@stevedonovan
stevedonovan / deb.lua
Created May 8, 2012
Correspondance between Lua modules and Debian packages (from ldeb)
View deb.lua
local packages = {
bit="liblua5.1-bitop0", -- -- fast bit manipulation library for the Lua language v
cgilua="liblua5.1-cgi0", -- -- CGI library for the Lua language version 5.1
sapi="liblua5.1-cgi0", -- -- CGI library for the Lua language version 5.1
copas="liblua5.1-copas0", -- -- Copas is a dispatcher of concurrent TCP/IP requests
cosmo="liblua5.1-cosmo0", -- -- A template library for the Lua langua version 5.1
coxpcall="liblua5.1-coxpcall0", -- -- Protected function calls across coroutines for Lua 5
curl="liblua5.1-curl0", -- -- libcURL bindings for the Lua language version 5.1
luaevent="liblua5.1-event0", -- -- asynchronous event notification library for Lua vers
lxp="liblua5.1-expat0", -- -- libexpat bindings for the Lua language version 5.1
@stevedonovan
stevedonovan / array.lua
Created Mar 26, 2012
Covariance with pl.class: a specialized List of numbers
View array.lua
require 'pl'
class.Array(List)
function Array.__add (a1,a2)
return a1:map2('+',a2)
end
function Array.__sub (a1,a2)
return a1:map2('-',a2)
@stevedonovan
stevedonovan / ml.lua
Created Feb 15, 2012
Microlight - a really compact set of general Lua functions
View ml.lua
-----------------
-- Microlight - a very compact Lua utilities module
--
-- Steve Donovan, 2012; License MIT
-- @module ml
local ml = {}
--- String utilties.
-- @section string
@stevedonovan
stevedonovan / list.moon
Created Dec 15, 2011
An example of a MoonScript class
View list.moon
import insert,concat,remove from table
class List
new: (t) =>
@ls = t or {}
add: (item) =>
insert @ls,item
@stevedonovan
stevedonovan / csvdta.go
Created Dec 2, 2011
A Go package which reads structure data from CSV data using reflection
View csvdta.go
package csvdata
// csvdata complements the csv package by allowing you to map a custom structure to
// the columns of data in a CSV file. The struct needs to be annotated so that each
// field can match a column in the data
//
// type Person struct {
// FirstName string `field:"First Name"`
// Second_Name string
// Age int
// }
@stevedonovan
stevedonovan / loader.lua
Created Oct 19, 2011
A Custom Lua module loader for Lua 5.2
View loader.lua
-- This allows a more restricted module() style; the key feature
-- is that each module is loaded in a custom environment, and the actual module
-- table is a copy of that environment after initial load.
-- clone _G so that globals from the program don't invade the module
local lua_libs = {}
for k,v in pairs(package.loaded._G) do
lua_libs[k] = v
end
@stevedonovan
stevedonovan / html.lua
Created Sep 5, 2011
Orbit-style Htmlification using LuaExpatUtils
View html.lua
--[[
See http://steved-imaginaryreal.blogspot.com/2011/09/htmlification-with-lua.html
Example usage:
-- test2.lua
require 'html'
html {
body { title 'Test' },
h2 'title',
p 'first para',
@stevedonovan
stevedonovan / css.lua
Created Aug 30, 2011
A little Lua DSL for generating CSS
View css.lua
--[[
A Lua module that defines a little DSL for generating CSS
-- csstest.lua
require 'css'
width = 500
lmargin = 50
leftm = 150
gap = 10
You can’t perform that action at this time.