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
module('mybot.wikipedia') | |
command = 'wiki' | |
local function get_mw_results(url, query) | |
-- do something | |
end | |
function handlemessage(msg) | |
local body = msg.body |
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 names = {'wikipedia'} | |
plugins = {} | |
for _, plugin_name in ipairs(names) do | |
local plugin_env = setmetatable({}, { __index = getfenv(0), __metatable = {} }) | |
local plugin_chunk = loadfile(plugin_name .. '.lua') | |
setfenv(plugin_chunk, plugin_env) | |
pcall(plugin_chunk) |
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 t =setmetatable({}, {__call = function(s) | |
return next, s | |
end}) | |
t.foo = 1 | |
t.bar = 2 | |
t.baz = 3 | |
for k in t() do | |
print(k) |
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 t = setmetatable({}, {__call = function(self, state, k) | |
return next(self, k) | |
end}) | |
t.foo = 1 | |
t.bar = 2 | |
t.baz = 3 | |
for k, v in t do | |
print(k, v) |
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
pegasus:cpan-api rob$ git submodule update | |
fatal: reference is not a tree: d334fdfedf99f806923dc40d98151d817de3dd51 | |
Unable to checkout 'd334fdfedf99f806923dc40d98151d817de3dd51' in submodule path 'inc/monken/p5-elasticsearch-model' |
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
fatal: reference is not a tree: d334fdfedf99f806923dc40d98151d817de3dd51 | |
Unable to checkout 'd334fdfedf99f806923dc40d98151d817de3dd51' in submodule path 'inc/monken/p5-elasticsearch-model' |
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 pluto = require 'pluto' | |
local limit = arg[1] | |
if not limit then | |
limit = 1 | |
end | |
t = {} | |
for i=1,limit do | |
t = { t } |
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
use strict; | |
use warnings; | |
use Test::More tests => 1; | |
use Plack::Test; | |
$Plack::Test::Impl = 'AnyEvent'; | |
test_psgi $app, sub { | |
my ( $cb ) = @_; |
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
use strict; | |
use warnings; | |
use HTTP::Request::Common; | |
use Test::More tests => 36; | |
use Test::More; | |
use Plack::Test; | |
my $simple_app = sub { | |
my ( $env ) = @_; |
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 lua | |
require 'lgob.loader' | |
package.loadlib('lgob.webkit', 'luaopen_lgob_webkit') |
OlderNewer