Skip to content

Instantly share code, notes, and snippets.

View simonask's full-sized avatar

Simon Ask Ulsnes simonask

View GitHub Profile
#include <w>
int main(int argc, char const *argv[])
{
w::App app { argc, argv };
app.get("/hello", [](w::Request&) { return w::render_text("Hello world"); });
return app.run();
}
#include <stdio.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <string.h>
#define PAGESIZE 4096
typedef unsigned char byte;
int main (int argc, char const *argv[])
{
byte* a = (byte*)malloc(PAGESIZE);
Array.instance_prototype.detect: [block] {
cc: Kernel.cc
.each { cc.return(it) if block(it) }
false
}
real 0m0.506s
user 0m0.498s
sys 0m0.003s
real 0m0.503s
user 0m0.495s
sys 0m0.003s
real 0m0.510s
user 0m0.499s
real 0m0.687s
user 0m0.677s
sys 0m0.004s
real 0m0.683s
user 0m0.674s
sys 0m0.004s
real 0m0.673s
user 0m0.663s
static int n = 0;
int make(int t) { return t; }
void foo_a() { ++n; }
void foo_b() { ++n; }
void foo_c() { ++n; }
void foo_d() { ++n; }
int foo(int t)
static int n = 0;
class A {
public:
virtual void foo() {
++n;
}
};
class B : public A {
obj.set_instance_var(:@foo, 123)
@foo = 456
obj.instance_eval {
puts @foo #=> 123
}
a: 123
foo: {
a: 456
}
foo()
puts(a) // 123 eller 456?
foo: [a, b, *rest] {
bar: [*args] {
baz(*rest, *args)
local a, b: *args
}
}