Before getting started Configuring the Actions workflow Installing dependencies with LuaRocks Testing multiple versions of Lua with a matrix Running the action/workflow Add a status badge to your repository GitHub Actions is a free tool provided by G... Read more...| leafo.net
Calculating The Median Calculating A Perentile Calculating All Percentiles Modern versions of PostgreSQL (≥ 9.4) make it easy to calculate the percentile for a list of values at any percentage using the percentile_cont and percentile_disc ordered-s... Read more...| leafo.net
NGINX is known for its reverse proxy functionality: NGINX acts as a gateway server that can forward requests to a backend, while managing a large number of connections and ensuring clients are behaving correctly. Typically the server you proxy too is... Read more...| leafo.net
Avoiding n+1 queries Using a join Using a second query More preloading strategies Composite types Using JSON as a join alternative Selecting a subset of columns Getting a subset of a one to many relationship Subquery and row_to_json Querying hierarch... Read more...| leafo.net
OpenResty is the platform I use to build all of my web applications. At the moment, OpenResty only builds with OpenSSL 1.0 , but my distribution (Arch Linux), and maybe yours, has moved to OpenSSL 1.1. With a plain ./configure this means that OpenRes... Read more...| leafo.net
itch.io is a website for hosting indie games, its implementation is unique because it’s written entirely in Lua ( MoonScript ). It runs inside of an nginx distribution called OpenResty . It uses coroutines for all asynchronous operations like d... Read more...| leafo.net
How Lua finds packages Setting the path with LuaRocks The install locations Using a custom directory Quick guide Installing a package Running scripts with packages Local install Global install LuaRocks is the package manager for Lua. When you decide ... Read more...| leafo.net
What is dynamic scoping An example Implementing dynamic scoping When to use dynamic scoping What is dynamic scoping Dynamic scoping is a programming language paradigm that you don’t typically see. The scoping that most programmers are used to i... Read more...| leafo.net
DSLs, or domain specific languages, are programming languages that are designed to implement a set of features specific to a particular problem or field. An example could be Make , the build tool, which is a specially designed language for combining ... Read more...| leafo.net
Have you ever considered whether functions in Lua are mutable or not. In Lua, objects are mutable because properties and metatables can be changed. Strings and numbers are examples of types that aren’t mutable: string library functions return n... Read more...| leafo.net
If you've programmed in Lua 5.1 you've probably come across the function setfenv (and the associated getfenv ). Lua 5.2 removed those functions favor of the _ENV variable. The _ENV variable is an interesting change, and can accomplish many ... Read more...| leafo.net
MoonScript’s class system is great balance of functionality and brevity. It’s simple to get started with, doesn’t impose many restrictions, and is incredibly flexible when you need to do advanced things or bend the rules. Even if yo... Read more...| leafo.net
I registered leafo.net over 11 years ago, on April 25th 2004, with nothing in mind. By December I had managed to turn it into a complete CMS with message board, blog posts, tutorials, news aggregator, and a flash arcade. My internet friends registere... Read more...| leafo.net
What is a PEG What is LPeg Installing LPeg Some simple grammars String equality Combining patterns Parsing numbers A calculator expression parser Closing What is a PEG A PEG, or Parsing Expression Grammar, is a way of describing a language (or patter... Read more...| leafo.net
The modules pgmoon Installation Connecting Queries Preventing SQL injection Connection pooling Reference manual Issues I had with other modules The modules OpenResty is a special distribution on Nginx designed for building web applications in Lua. In... Read more...| leafo.net
Today I'm launching a new website called Streak Club. It’s a site for anyone to host creative streaks (I'll explain below). Check it out at http://streak.club Why What’s a streak Let’s draw for a year Technology Why Over t... Read more...| leafo.net
Today I'll be showing you how to create a fast on the fly image processing server. The whole system can be created in less than 100 lines of code. We'll be using OpenResty , an enhanced distribution of Nginx. We'll also need to write a... Read more...| leafo.net
I'm happy to announce MoonScript version 0.2.4, the CoffeeScript inspired language that compiles to Lua. It’s been about 5 months since the last release. MoonScript 0.2.4 — moonscript.org Changes New Things Bug Fixes Code Generation ... Read more...| leafo.net
Today I'm launching a new website called itch.io . It’s a marketplace for hosting indie games with a ‘pay what you want’ pricing model. Anyone can quickly upload their game and then customize the game’s page. Check it out... Read more...| leafo.net
Today marks MoonScript version 0.2.3, the CoffeeScript inspired language that compiles to Lua. It’s been about 3 months since last release. I've got a couple new features, fixes, Lua 5.2 support and a backwards incompatible change. MoonScr... Read more...| leafo.net
— Today marks MoonScript version 0.2.2, the CoffeeScript inspired language that compiles to Lua. It’s been approximately 11 months since the last release, and I'd like to apologize for the long gap. Hopefully we'll see more freq... Read more...| leafo.net
I've been using the FuzzyFinder plugin for Vim for quite some time. It’s an invaluable part of my development toolbox. I've tried a handful other fuzzy style file finders, but FuzzyFinder always has been the most reliable. There&rsquo... Read more...| leafo.net
Last updated Fri May 2 2014 MoonScript is an open source prgramming language which compiles into Lua . Lua is a very powerful dynamically typed language. It supports features like functions as first class objects, closures, tail-recursion and a high ... Read more...| leafo.net
Since the release of Heroku ’s Cedar platform they've opened up the opportunity for users to run web applications on any stack. Using something called a buildpack we can describe a template for deploying any kind of application. I saw this... Read more...| leafo.net
Exactly 3 months ago I released MoonScript . The CoffeeScript inspired language that compiles to Lua. Since then I've both written a lot of MoonScript and enhanced the MoonScript compiler. Today I'm proud to release v0.2.0. I've got a ... Read more...| leafo.net
What is dynamic scoping An example Implementing dynamic scoping When to use dynamic scoping What is dynamic scoping Dynamic scoping is a programming language paradigm that you don’t typically see. The scoping that most programmers are used to i...| leafo.net