Skip to content

Instantly share code, notes, and snippets.

View flyx's full-sized avatar

Felix Krause flyx

View GitHub Profile
@flyx
flyx / bla.adelheid
Created May 7, 2012 19:45
Quelltext der imaginäre Programmiersprache Adelheid 2005
Paket Eigenheim ist
Sorte Geschirr ist Stapel (Positiver Bereich <>) von Teller;
Paket Tellerhaufen ist neuer Haufen mit (Gegenstand => Teller);
Aufgabe Küche_Machen ist
Einsprungspunkt Dreckiges_Geschirr_Kommt (Dreckiges_Geschirr : Geschirr);
Ende von Küche_Machen;
@flyx
flyx / foo.adb
Created May 3, 2012 20:20
Example package where a "protected" scope would be nice
package Foo is
type A is abstract tagged null record;
-- some functionality A provides
procedure Bar (Object : A);
-- some part of this functionality that depends
-- on the specific child-classes of A
-- this function should not be visible to other
-- packages, but it has to be visible to packages
@flyx
flyx / test.php
Created April 9, 2012 14:58
PHP doesn't care about array index ordering (expected output: "hurrdurrwarbl"; actual output: "hurrwarbldurr")
<?php
$arr = array();
$arr[0] = "hurr";
$arr[2] = "warbl";
$arr[1] = "durr";
foreach($arr as $item) {
echo $item;
}
?>
with Ada.Containers.Hashed_Maps;
with Interfaces.C;
package Example is
type UInt is new Interfaces.C.unsigned;
type Whatever is new Integer;
function Hash (Key : UInt) return Ada.Containers.Hash_Type;
package My_Maps is new Ada.Containers.Hashed_Maps (
generic
-- defines maximum depth of tree
type Node_Level is <>;
package Tree is
-- it's a binary tree. for now.
type Tree_Direction is (Left, Right);
type Direction_Array is array (Node_Level range <>) of Tree_Direction;
class A {
void method(A someObj) {
// .. do something here
}
}
class B extends A {
// .. declare something here
}
FILE "siedler2.iso" BINARY
TRACK 01 MODE1/2048
INDEX 01 00:00:00
FILE "track02.ogg" MP3
TRACK 02 AUDIO
PREGAP 00:02:00
INDEX 01 00:00:00
FILE "track03.ogg" MP3
TRACK 03 AUDIO
INDEX 01 00:00:00
aggregate project OpenCLAda is
type Toggle is ("Enabled", "Disabled");
GL_Support : Toggle := external ("GL_BINDING"; "Disabled");
case GL_Support is
when "Enabled" =>
for Project_Files use ("openclada_gl_binding.gpr");
when "Disabled" =>
for Project_Files use ("openclada_core.gpr");
end case;
end OpenCLAda;
<?php
/**
* concerts
*/
class Concert extends ORMBase {
/**
* INT(10)
*/
@flyx
flyx / whatev.ads
Created February 5, 2012 11:09
Example interfacing with C and arrays in Ada
with Interfaces.C;
package Whatev is
package C renames Interfaces.C;
type Vector_Index is (X, Y, Z, W);
type Vector is array (Vector_Index range <>) of aliased C.double;
pragma Convention (C, Vector);
procedure Vertex (Value : Vector);