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
insertion_thresold = 16 | |
function less_than(a, b) | |
return a < b | |
end | |
function insertion_sort(array, compare, istart, iend) | |
for i = istart + 1, iend do | |
current_value = array[i] | |
hole_index = i |
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
#include "ray.h" | |
static ray_fiber_t* RAY_MAIN; | |
static uv_async_t RAY_PUMP; | |
void ray_pump(void) { | |
uv_async_send(&RAY_PUMP); | |
} | |
ray_fiber_t* ray_current(lua_State* L) { |
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
#include "ray.h" | |
int ray_last_error(ray_ctx_t* self) { | |
uv_err_t err = uv_last_error(self->loop); | |
return err.code; | |
} | |
const char* ray_strerror(int code) { | |
uv_err_t err = { .code = code }; | |
return uv_strerror(err); | |
} |
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
--[=[ | |
dump = header proto+ 0U | |
header = ESC 'L' 'J' versionB flagsU [namelenU nameB*] | |
proto = lengthU pdata | |
pdata = phead bcinsW* kgc* knum* uvdataH* [debugB*] | |
phead = flagsB numparamsB framesizeB numuvB numkgcU numknU numbcU | |
[debuglenU [firstlineU numlineU]] | |
kgc = kgctypeU { ktab | (loU hiU) | (rloU rhiU iloU ihiU) | strB* } | |
knum = intU0 | (loU1 hiU) | |
ktab = narrayU nhashU karray* khash* |
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
ocal luv = require('luv') | |
local response_html = "<p>Hello, world!</p>" | |
local response_size = #response_html | |
local http_response = "HTTP/1.0 200 OK\r\ | |
Content-Type: text/html\r\ | |
Content-Length: "..tostring(response_size).."\r\ | |
Connection: Keep-Alive\r\ | |
\r\ | |
"..response_html |
NewerOlder