Skip to content

Instantly share code, notes, and snippets.

@olueiro
olueiro / class.lua
Created April 3, 2020 22:27
Lua class with safe sentinel
--[==[
(c) 2020 MIT licensed
Usage example:
local class = require("class")
-- local class = require("class").safe() -- add .safe() on require to make class safe (Lua pcall is wrapped in each class function)
local my_class = class.new(start_param_1, start_param_2 --[[, ...]])
@olueiro
olueiro / openresty-ubuntu-install.sh
Last active October 8, 2019 12:01
Easy install openresty (updated)
#!/bin/bash
apt-get -y update
apt-get -y install build-essential libpcre3-dev libssl-dev libgeoip-dev libpq-dev libxslt1-dev libgd2-xpm-dev curl
curl -L -o openresty-1.15.8.2.tar.gz https://openresty.org/download/openresty-1.15.8.2.tar.gz
tar -xvf openresty-1.15.8.2.tar.gz
cd openresty-1.15.8.2/
./configure \
--sbin-path=/usr/sbin/nginx \
@olueiro
olueiro / moonscript.lua
Last active May 26, 2020 00:34
Integration with Moonscript language for ZeroBrane Studio with auto generate lua from the moon on save current tab. Follow this instructions (https://github.com/pkulchenko/ZeroBranePackage#installation) to install this plugin.
-- Copyright 2014 Paul Kulchenko, ZeroBrane LLC; All rights reserved
-- improvements by github.com/olueiro
local exe
local win = ide.osname == "Windows"
local init = [=[
(loadstring or load)([[
if pcall(require, "mobdebug") then
io.stdout:setvbuf('no')