This file contains 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
#!/usr/bin/env sh | |
if [ $# -gt 0 ] | |
then | |
CODE="#include <stdio.h>"$'\n'"int main() { printf(\"%lu\n\", sizeof($@)); return 0; }" | |
echo "$CODE" | gcc -o size -x c - && ./size && rm -f size | |
fi |
This file contains 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
/* | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation, either version 3 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU General Public License for more details. |
This file contains 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
Function.prototype.extends = function(Parent) { | |
this.prototype = Object.create(Parent.prototype); | |
this.prototype.constructor = this; | |
}; | |
//Now | |
/* | |
function Rectangle(w, h) { | |
this.width = w; | |
this.height = h; |
This file contains 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
/* | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation, either version 3 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU General Public License for more details. |
This file contains 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 <stdlib.h> | |
#include <string.h> | |
int main(int argc, const char **argv) { | |
size_t chunk = 0b1 << 10; | |
size_t interval = 0b1 << 15; | |
size_t i = 0; | |
char *ptr = malloc(chunk * (i + 1)); | |
while (ptr != NULL) { |
This file contains 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
/// Aims to create enumerated constants. | |
/// # Example | |
/// ``` | |
/// pub struct Foo; | |
/// impl Foo { | |
/// enum_consts! { | |
/// pub const: u32 => | |
/// BAR, | |
/// BAZ, | |
/// } |
This file contains 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
defmodule Paramath do | |
def fast_fac(n, procn, pid) do | |
recver = spawn_link(fn -> recv(procn, 1, pid) end) | |
mkfac(n, div(n, procn) + rem(n, procn), recver) | |
end | |
defp mkfac(n, intval, out) do | |
cond do | |
n > intval -> | |
spawn_link(fn -> calc_range(n, n - intval, 1, out) end) | |
mkfac(n - intval, intval, out) |
This file contains 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
<?php | |
function utf8_to_charcode(string $utf8, &$i = null): int { | |
$i = (int) $i; | |
if ($i >= strlen($utf8)) { | |
return -1; | |
} | |
$first = ord($utf8[$i]); | |
if ($first >> 3 === 0xf << 1) { | |
$code = $first & 0x7; |
This file contains 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
module Stlc where | |
open import Agda.Builtin.String | |
data Type : Set where | |
σ : Type | |
τ : Type | |
_⟶_ : Type → Type → Type | |
data Var : (a : Type) → Set where |
This file contains 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
module DependentCond where | |
data Bool : Set where | |
false : Bool | |
true : Bool | |
choose : Bool → Set → Set → Set | |
choose true x _ = x | |
choose false _ x = x |
OlderNewer