This file contains hidden or 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
| > wsapi -p80 /var/www | |
| [Xavante launcher] Starting Xavante... | |
| [2009-10-27 21:44:21] Xavante started on port(s) 80 |
This file contains hidden or 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
| local env = luasql.sqlite3() | |
| local db = todo.real_path .. "/todo.db" | |
| local timeout = 3600 -- one hour | |
| todo.mapper.conn = recycle(function () | |
| return env:connect(db) | |
| end, timeout) |
This file contains hidden or 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
| #!/usr/bin/lua | |
| pcall(require,"luarocks.require") | |
| local common = require "wsapi.common" | |
| local fastcgi = require "wsapi.fastcgi" | |
| local ONE_HOUR = 60 * 60 | |
| local ONE_DAY = 24 * ONE_HOUR |
This file contains hidden or 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
| require "orbit" | |
| require "orbit.routes" | |
| local R = orbit.routes.R | |
| local hello = orbit.new() | |
| hello:dispatch_get(function (web) | |
| return string.format('<h1>Welcome to %s!</h1>', web.real_path) |
This file contains hidden or 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
| #!/usr/bin/env wsapi.cgi | |
| require "orbit" | |
| require "orbit.routes" | |
| local R = orbit.routes.R | |
| local hello = orbit.new() | |
| hello:dispatch_get(function (web) |
This file contains hidden or 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
| local todo = orbit.model.new() | |
| todo.conn = luasql.sqlite3()::connect("todo.db") | |
| local todo_list = todo:model("todo_list") |
This file contains hidden or 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
| local item = todo_list:new() | |
| item.title = "Todo Item" | |
| item.done = true | |
| item:save() | |
| assert(item.id ~= nil) |
This file contains hidden or 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
| local done_recently = todo_list:find_all("done = ? and updated_at >= ?", | |
| { true, os.time{ year = 2009, month = 11, day = 01 }, order = "created_at desc" }) | |
| for _, item in ipairs(done_recently) do | |
| print(item.title) | |
| end |
This file contains hidden or 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
| local lpeg = require "lpeg" | |
| local re = require "re" | |
| local json = require "json" | |
| local P = lpeg.P | |
| local S = lpeg.S | |
| local R = lpeg.R | |
| local C = lpeg.C | |
| local Ct = lpeg.Ct |
This file contains hidden or 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
| #!/usr/bin/env wsapi.cgi | |
| local mk = require "mk" | |
| local R = require "mk.routes" | |
| local request = require "wsapi.request" | |
| local response = require "wsapi.response" | |
| local cosmo = require "cosmo" | |
| local template = require "mk.template" | |
| local themes = require "mk.themes" |