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
void render() { | |
// Tiles | |
for (int i = 0; i < columns; ++i) | |
{ | |
for (int j = 0; j < rows; ++j) | |
{ | |
glBegin(GL_QUADS); | |
glColor3f(0.0, 1.0, 0.0); | |
glVertex2f(i*tile_width, j*tile_height); | |
glVertex2f(i*tile_width+tile_width, j*tile_height); |
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
foo: [a, b] { return a + b } | |
puts(foo.disassemble()) |
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 <iostream> | |
using namespace std; | |
template <int N> int fib() { | |
return fib<N-1>() + fib<N-2>(); | |
} | |
template <> | |
int fib<0>() { |
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
class Base { | |
private: | |
int m_Lol; | |
public: | |
Base(int lol) : m_Lol(lol) {} | |
}; | |
class Foo : public Base { | |
public: | |
Foo() : Base(123) {} |
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 <stdio.h> | |
class Mixin1 { | |
protected: | |
Mixin1() {} | |
public: | |
int a, b, c; | |
}; | |
class Mixin2 { |
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
xml: XmlBuilder() | |
xml { | |
.root { | |
.element1(attr: "hej") { | |
.cdata("MUUUUH") | |
} | |
.element2(whatever: "lals") { | |
.cdata("...") | |
} |
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
template <typename T> class Delegate; | |
template <typaname T> class DelegateFunction; | |
// Specialization for 2-argument callbacks: | |
template <typename C, typename R, typename A1, typename A2> | |
class DelegateMemberFunction : public DelegateFunction<R, A1, A2> { | |
private: | |
C* m_Instance; | |
R (*m_Function)(A1, A2); | |
public: |
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 <stdio.h> | |
#include <dlfcn.h> | |
extern "C" int foo() { | |
puts("LOOOOOL"); | |
} | |
int main() { | |
void* handle = dlopen(NULL, RTLD_NOW); | |
int(*my_foo)() = dlsym(handle, "foo"); |
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
require("dlopen") | |
Something: module { | |
lib: dlopen("libsomething.dylib") | |
.foo: lib.symbol("foo", INT, POINTER) | |
.bar: lib.symbol("bar", POINTER) | |
} | |
ptr: Something.bar() |
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
Foo: class { | |
get_stuff: { /* do it */ } | |
.property(#stuff, get_stuff, nil) | |
} | |
foo: Foo.new() | |
foo.stuff // => get_stuff() | |
foo.stuff: 2 // => ERROR |