This file contains hidden or 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 how you write specs: | |
| import load_test_server, close_test_server from require "lapis.spec.server" | |
| import request_with_phantom from require "spec_integration.helpers" | |
| describe "integration", -> | |
| setup -> | |
| load_test_server! | |
| teardown -> |
This file contains hidden or 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
| start <- block space ! . | |
| word <- [a-zA-Z_] [a-zA-Z_0-9] * | |
| empty_line <- space & stop | |
| string_interpolation <- "#{" ( &{ start("interpolation") } exp space "}" &{ accept("interpolation") } / &{ reject("interpolation") } ) | |
| while <- &{ start("while") } space "while" [^a-zA-Z_0-9] exp space ( space "do" [^a-zA-Z_0-9] ( &{ start() } statement &{ accept() } / &{ reject() } ) / break body ) &{ accept("while") } / &{ reject("while") } | |
| body <- & ( < space > &{ advance_indent(yytext) } ) ( &{ start() } ( line ( break line ) * &{ pop_indent() } / &{ pop_indent() } &{ 0 } ) &{ accept() } / &{ reject() } ) | |
| unbounded_table <- &{ start("table") } ( &{ start() } key_value_list &{ accept() } / &{ reject() } ) &{ accept("table") } / &{ reject("table") } | |
| line <- < space > &{ check_indent(yytext) } statement / empty_line | |
| table_value <- key_value / &{ start() } exp &{ accept() } / &{ reject() } | |
| space <- [ \t] * |
This file contains hidden or 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 to_lua from require "moonscript.base" | |
| for i=1,250 | |
| print "tick", i | |
| to_lua "x = ->" |
This file contains hidden or 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
| <iframe src="//itch.io/embed/16866" width="552" height="167" frameborder="0"></iframe> |
This file contains hidden or 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 test_urls { | |
| xargs -n 1 -P 50 curl -s -o /dev/null -w "%{http_code} %{url_effective}\n" | |
| } |
This file contains hidden or 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
| socket = require "socket" | |
| app = require "app" | |
| app = app! | |
| app.router\build! | |
| paths = for route in *app.router.routes | |
| route[1]\gsub ":%w+", "1" | |
| start = socket.gettime! |
This file contains hidden or 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() | |
| app:match("/my-thing", respond_to { | |
| on_error = function(self) | |
| -- the view will have access to self.errors | |
| return { render = true } | |
| end, | |
| before = function(self) | |
| -- do everything to set up the view, since if we get an error we need to rerender |
This file contains hidden or 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
| user derek users; | |
| worker_processes 1; | |
| error_log logs/error.log; | |
| # I like to use these two directives for development so I can have server and log in foreground | |
| # daemon off; | |
| # error_log stderr notice; | |
| events { | |
| worker_connections 1024; |
This file contains hidden or 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
| { | |
| names: {"one", "two", "three"} | |
| } | |
| The names: | |
| <ul> | |
| $each{names, "name"}[[<li>name: $name</li>]] | |
| </ul> |