Skip to content

Instantly share code, notes, and snippets.

View leafo's full-sized avatar
🐔
bock bock

leaf leafo

🐔
bock bock
View GitHub Profile
http://itch.io/api/1/KEY/my-games/graphs?num_days=30
`num_games` optional, defaults to 7.
Fetches graph data for the past `num_days`. Days with 0 don't have entries.
{
"purchases":[
{
"date":"2014-04-08",
@leafo
leafo / gist:11390484
Created April 29, 2014 04:12
grunt assemble test
module.exports = function(grunt) {
var pages = grunt.file.readJSON("data/pages.json");
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
assemble: {
options: {
layout: "templates/layout.hbs",
dad: "hello world",
When you buy something the percentage you paid above the minimum is stored with
the purchase. When checking to see if purchase has access to a file with a
separate minimum price the percentage above is applied to the current minimum
price to calculate "effective purchase pirce".
For example, you have a game for 5 dollars, and a bonus file at 10 dollars.
A user buys the game for 10 dollars to get the extra download.
error_log stderr notice;
daemon off;
events {
worker_connections 1024;
}
http {
include mime.types;
variables_hash_max_size 1024;
function _annotate() {
echo "$(tput setaf 4)>>$(tput sgr0) $@"
eval $@
}
function gup() {
branch=$([[ -n "$1" ]] && echo "$1" || git rev-parse --abbrev-ref HEAD)
dirty=$(git diff --shortstat 2> /dev/null | tail -n1)
_annotate git fetch || return
name | downloads
-----------------------+-----------
luafilesystem | 8267
say | 8214
moonscript | 7993
ansicolors | 7849
lua_cliargs | 7753
dkjson | 7661
luassert | 7457
alt-getopt | 7401
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
"strings"
)
require 'breeze'
-- declare class
FooHandler = class('FooHandler', ActiveHandler)
-- constructor
function FooHandler:initialize()
-- call base class constructor
ActiveHandler.initialize(self)
@leafo
leafo / app.lua
Created July 10, 2014 05:17
Spreading a Lua Lapis application across multiple files
local app = lapis.Application()
package.loaded.app = app
require "app_1"
require "app_2"
return app
@leafo
leafo / app.lua
Last active August 29, 2015 14:03
local lapis = require "lapis"
local app = lapis.Application()
app:get("/", function()
local http = require "lapis.nginx.http"
local util = require "lapis.util"
local api = "https://www.googleapis.com/pagespeedonline/v1/runPagespeed?"
local res, status = http.simple(api .. util.encode_query_string {
url = "http://leafo.net",