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 domain, count(*) from (select (regexp_matches(purchase_referrers.referrer, '//(.*?)/'))[1] as domain from purchase_referrers inner join purchases on purchases.id = purchase_referrers.purchase_id where purchases.status = 1 and purchase_referrers.type = 2) as domains group by domain order by count desc; |
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
* << BeReq >> 32771 | |
- Begin bereq 32770 fetch | |
- Timestamp Start: 1408054950.451976 0.000000 0.000000 | |
- BereqMethod GET | |
- BereqURL /dump/Music%20Pack.rar | |
- BereqProtocol HTTP/1.1 | |
- BereqHeader User-Agent: curl/7.37.1 | |
- BereqHeader Accept: */* | |
- BereqHeader X-Forwarded-For: 206.169.213.106 | |
- BereqHeader Host: leafo.net |
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
lapis = require "lapis" | |
import capture_errors from require "lapis.application" | |
import assert_valid from require "lapis.validate" | |
import json_params from require "lapis.application" | |
class App extends lapis.Application | |
"/test": json_params capture_errors { | |
on_error: => | |
json: @errors, status: 401 |
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 sleep from require "socket" | |
async_function = (fn) -> | |
fn! | |
-- async_function -> | |
-- print "first" | |
-- async_function -> | |
-- print "second" | |
-- async_function -> |
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
class FakeRedis | |
new: => | |
@called = {} | |
for m in *{ "set_timeout", "connect", "multi", "sadd", } | |
@__base[m] = (...) => | |
@called[m] = ... | |
true | |
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
class Test | |
__field_missing: (name) => | |
print "method is missing:", name | |
old = @__base.__index | |
@__base.__index = (name) => | |
old[name] or @__field_missing name | |
x = Test! |
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 username, email, games_count, user_data.data from users | |
inner join user_data on user_data.user_id = users.id | |
where ( | |
select count(*) from games | |
where | |
games.user_id = users.id and | |
paid_status > 1 and published and | |
not deleted and classification = 0 and purchases_count > 0 | |
) > 1 order by games_count desc; |
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: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", |
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 app = lapis.Application() | |
package.loaded.app = app | |
require "app_1" | |
require "app_2" | |
return app |