Skip to content

Instantly share code, notes, and snippets.

View leafo's full-sized avatar
🐔
bock bock

leaf leafo

🐔
bock bock
View GitHub Profile
require 'breeze'
-- declare class
FooHandler = class('FooHandler', ActiveHandler)
-- constructor
function FooHandler:initialize()
-- call base class constructor
ActiveHandler.initialize(self)
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
"strings"
)
name | downloads
-----------------------+-----------
luafilesystem | 8267
say | 8214
moonscript | 7993
ansicolors | 7849
lua_cliargs | 7753
dkjson | 7661
luassert | 7457
alt-getopt | 7401
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
error_log stderr notice;
daemon off;
events {
worker_connections 1024;
}
http {
include mime.types;
variables_hash_max_size 1024;
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.
@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",
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 / web.lua
Last active August 29, 2015 13:59
-- LuaJIT 2.1.0-alpha 27c453e
-- jit.off() -- no error when jit is off
local t = {
msg = "hello",
}
local function breaks(parts)
local out = ""
if parts.msg then
-- vacuum and analyze stats
SELECT relname, last_vacuum, last_autovacuum, last_analyze, last_autoanalyze FROM pg_stat_user_tables;
-- scan vs index rate
select relname, seq_scan, idx_scan, round(seq_scan::numeric/(seq_scan + idx_scan),4) ratio
from pg_stat_user_tables order by ratio desc;