Skip to content

Instantly share code, notes, and snippets.

View lbguilherme's full-sized avatar

Guilherme Bernal lbguilherme

View GitHub Profile
@lbguilherme
lbguilherme / todo-html.cr
Last active March 4, 2022 11:08
Crystal front-end app, what would it look like?
# This is a sample of what a front-end Crystal application could look like, for code review.
# The design was inspired by React, Angular and Flutter and it should be very performing and compact.
# If this is ever implemented, it will use WebAssembly to run Crystal code, together with
# some JavaScript bindings to access the DOM.
class TodoData
property text : String
property? done = false
def initialize(@text)
@lbguilherme
lbguilherme / todo-html2.cr
Last active March 4, 2022 13:09
Crystal front-end app, what would it look like?
# This is a sample of what a front-end Crystal application could look like, for code review.
# The design was inspired by React, Angular and Flutter and it should be very performing and compact.
# If this is ever implemented, it will use WebAssembly to run Crystal code, together with
# some JavaScript bindings to access the DOM.
class TodoData
property text : String
property? done = false
def initialize(@text)
@lbguilherme
lbguilherme / sum.cpp
Created September 27, 2023 23:44
Sum all numbers of a file, separated by "\n"
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
off_t total_size = 0;
char* mmap_file(const char* name) {