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 luarocks.tags
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR steve.j.donovan@gmail.com
!_TAG_PROGRAM_NAME ltags //
!_TAG_PROGRAM_URL http://github.com/stevedonovan/ltags /official site/
!_TAG_PROGRAM_VERSION 0.1 //
Q fs\win32.lua /^function Q(arg)$/;" m struct:luarocks.fs.win32
Q fs\lua.lua /^function Q(arg)$/;" m struct:luarocks.fs.lua
_ fs\lua.lua /^local _, ftp = pcall(require, "socket.ftp")$/;" v file:
absolute_name fs\win32.lua /^function absolute_name(pathname, relative_to)$/;" m struct:luarocks.fs.win32
@stevedonovan
stevedonovan / from.lua
Last active Aug 29, 2015
Utility module to simplify initializing locals from tables or modules.
View from.lua
local debug = require 'debug'
-- from.lua
-- supports some useful shortcuts when creating locals from tables or modules
-- require 'from'
-- local sin,cos,tan = slots(3) from(math)
-- local import,printf = slots(2) from 'pl.utils'
-- local pretty,utils,xml = slots(3) from 'pl.*'
--
-- Uses the debug library, so it's not very fast - only use for top-level initialization!
@stevedonovan
stevedonovan / StringAccessor.lua
Created Dec 20, 2010
A Lua class for accessing individual characters in a string
View StringAccessor.lua
--[[ Example:
sa = StringAccessor 'hello'
for c in sa:iter() do
print(c)
end
print(sa[1],sa[3])
print('end',sa[-1])
--]]
@stevedonovan
stevedonovan / safe_array.lua
Created Dec 30, 2010
This defines an array with strict bounds checking. It is also impossible to set any existing index to a nil value, so the array remains free of holes. The table functions will not work on such arrays because they are userdata, giving an extra layer of pro
View safe_array.lua
local function out_of_range(i,n)
if type(i) == 'number' then
if i > 0 and i <= n then return true
else error('out of range',3)
end
else
error 'cannot index array by non-number type'
end
end
@stevedonovan
stevedonovan / lua_prompt.lua
Created Mar 28, 2011
An interactive Lua prompt for the Textadept editor
View lua_prompt.lua
-- makes interactive prompt dodgy.
-- (In an ideal world, should be able to switch this off only for
-- the message buffer)
_m.textadept.editing.AUTOPAIR = false
-- useful function which can safely handle argument lists containing nil;
-- the resulting table has n set to the real length.
local function pack (...)
local args = {...}
args.n = select('#',...)
@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 / 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 / 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 / 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 / mockup.ltp
Created Oct 11, 2012
Penlight-style Lua template for HTML with JavaScript; note @ used as escape!
View mockup.ltp
<!DOCTYPE HTML>
<html>
<head>
<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.