I hereby claim:
- I am giann on github.
- I am giann (https://keybase.io/giann) on keybase.
- I have a public key ASDCyQPp-y67NC7iEpvqP98x5vj8iQat495Pznvu3cK6jgo
To claim this, I am signing this object:
const std = @import("std"); | |
const assert = std.debug.assert; | |
const mem = std.mem; | |
const Allocator = std.mem.Allocator; | |
const Buffer = std.Buffer; | |
pub fn wrap(allocator: *Allocator, string: []const u8, width: usize) ![]u8 { | |
assert(width > 3); | |
var justified = try Buffer.initSize(allocator, string.len); |
<template> | |
<div class="hello">{{ world | capitalize }}</div> | |
</template | |
<script lang="lua"> | |
local helpers = require "@/js-helpers.lua" | |
local Object = helpers.Object | |
local Array = helpers.Array | |
return Object { |
local new = js.new | |
local helpers = require "./js-helpers.lua" | |
local Object = helpers.Object | |
local Array = helpers.Array | |
local BASE_URL = helpers.webpack.process.env.BASE_URL | |
local isDev = helpers.webpack.process.env.NODE_ENV == "development" | |
local Vue = require "vue".default | |
local Router = require "vue-router".default | |
local Home = require "./views/Home.vue".default |
const path = require("path"); | |
module.exports = { | |
configureWebpack: { | |
module: { | |
rules: [ | |
{ | |
test: /\.lua$/, | |
oneOf: [ | |
// this applies to <template lang="lua"> in Vue components |
-- luacheck: ignore | |
local HelloWorld = Component { | |
-- Everything is wrote in Lua so rendered html | |
-- is always valid. | |
-- Chain of functions could build up a string | |
-- or a vdom | |
template = function(self) | |
return |
os.execute("/usr/bin/env stty raw -echo 2> /dev/null") | |
local term = require "term" | |
local function loop() | |
local char | |
repeat | |
term.cursor.save() | |
char = io.stdin:read(1) |
#include <SDL2/SDL.h> | |
#include <cairo/cairo.h> | |
#include <math.h> | |
void draw(cairo_t *cr) { | |
cairo_text_extents_t extents; | |
const char *utf8 = "cairo"; | |
// Hello world cairo | |
double x, y; |
I hereby claim:
To claim this, I am signing this object:
-- Fetch n url in parallel, must be run in a coroutine (co parameter) | |
local fetch = function(co, ...) | |
local requests = {...} | |
for i = 1, #requests do | |
local promise = js.global:fetch(requests[i]) | |
promise["then"](promise, function(_, res) | |
local textPromise = res:text() | |
textPromise["then"](textPromise, function(_, text) | |
co(i, text) | |
end) |
local co | |
local fetch = function(url) | |
local promise = js.global:fetch(url) | |
promise["then"](promise, function(_, res) | |
local jsonPromise = res:json() | |
jsonPromise["then"](jsonPromise, function(_, json) | |
co(json) | |
end) | |
end) |