This file contains 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
function _annotate() { | |
echo "$(tput setaf 4)>>$(tput sgr0) $@" | |
$@ | |
} | |
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 |
This file contains 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
create or replace function update_game_search(_game_id integer) returns text as $$ | |
declare | |
game record; | |
game_words tsvector; | |
game_facets tsvector; | |
index_lang regconfig := 'english'; | |
begin | |
select title, short_text, p_windows, p_linux, p_osx, deleted, published, | |
min_price, genre, "type" | |
into game |
This file contains 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
-- total games | |
itchio=# select count(*) from games where not deleted and published; | |
count | |
------- | |
258 | |
(1 row) | |
-- total downloads |
This file contains 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
worker_processes 1; | |
error_log stderr notice; | |
daemon off; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
server { |
This file contains 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
select sum(count) from downloads_daily where date >= '2013-12-01' and date < '2014-1-1'; | |
6852 | |
select count(*) from games where published and not deleted and created_at >= '2013-12-01' and created_at < '2014-1-1'; | |
170 | |
select count(*) from purchases where status = 1 and created_at >= '2013-12-01' and created_at < '2014-1-1'; | |
1403 | |
select (sum(price)/100.0)::money from purchases where status = 1 and created_at >= '2013-12-01' and created_at < '2014-1-1'; |
This file contains 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
worker_processes 1; | |
error_log stderr notice; | |
daemon off; | |
# Adding these will make the second server correct | |
# env LUA_PATH; | |
# env LUA_CPATH; | |
events { | |
worker_connections 1024; |
This file contains 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 lapis = require("lapis") | |
local app = lapis.Application() | |
app:match("/user/:id", function(self) | |
return "Hello user " .. self.params.id | |
end) | |
-- named route | |
app:match("about", "/about", function() | |
return "welcome to the about page" |
This file contains 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
import config from require "lapis.config" | |
json_file = (fname) -> | |
json = require "cjson" | |
file = assert io.open fname | |
with json.decode file\read "*a" | |
file\close! | |
config {"production", "development"}, -> |
This file contains 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
this.is.a.long.line | |
-- in coffee script we can do this: | |
this | |
.is.a | |
.long.line | |
-- but in moonscript, with's syntax uses the . as prefix for line | |
with something |
This file contains 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
package.preload['moonscript.transform.names'] = function() | |
local build | |
do | |
local _obj_0 = require("moonscript.types") | |
build = _obj_0.build | |
end | |
local unpack | |
do | |
local _obj_0 = require("moonscript.util") | |
unpack = _obj_0.unpack |