Skip to content

Instantly share code, notes, and snippets.

module test;
template S(T) { struct S { alias P = T; alias ToInt = value-of!T.ToInt + 1; } }
struct Z { alias ToInt = 0; }
template ToType(alias T) {
static if (T > 0) { alias ToType=S!ToType!(T-1); }
else { alias ToType=Z; }
}
template Func2(T) {
alias Func2 = T[2] function(T[0], T[1]);
}
module test;
template S(T) { struct S { alias P = T; alias ToInt = value-of!T.ToInt + 1; } }
struct Z { alias ToInt = 0; }
template ToType(alias T) {
static if (T > 0) { alias ToType=S!ToType!(T-1); }
else { alias ToType=Z; }
}
template Func2(T) {
alias Func2 = T[2] function(T[0], T[1]);
}
(last (set-orbit-cam
(vec3f 0.618383 6.087035 -8.772034)
(vec3f 0.539558 0.000000 -0.609656)
30.000000)
(last
(set world (new-world))
(let (s (let
(sun (new-sun))
(last (set
(: sun 'texgen)
module mspatest;
import std.string, sqlite3, std.boehm, std.zlib, std.http, std.util, std.file;
static import c.stdlib;
import std.fun, std.cgi;
import mspa;
alias FOURSTRING = (string, string, string, string); // small shortcut
module std.sound.threaded; // separate playback thread
import std.sound.base, std.thread, std.time, std.list;
class ThreadedOutput : SoundOutput {
ThreadPool tp;
SoundOutput sup;
int maxOutstandingSamples;
void init(SoundOutput sup) {
tp = new ThreadPool 1;
module mspatest;
import std.string, sqlite3, std.boehm, std.zlib, std.http, std.util, std.file;
static import c.stdlib;
import std.fun, std.cgi, std.process;
import mspa;
alias FOURSTRING = (string, string, string, string); // small shortcut
module sudoku;
import std.util, std.coroutine, std.string, std.fun;
auto solve(string puz){
alias s=string,v=void delegate(s);
void S(s p,v y){
if (auto i=p.find"0"){p=p.dup;for int k<-0..9 if!sum$(0..81).select(λ(int j)->(i%9==j%9||i/9==j/9||i/27==j/27&&(i%9)/3==(j%9)/3))
.map(λ(int i)->(p[i]=="1"+k)).eval{p[i]="123456789"[k];p.S y;}}else y p;}
return setupCoIterator!s new λ(v y)->puz.S y;
@FeepingCreature
FeepingCreature / rulebritannia.sh
Created January 2, 2015 18:42
Replace the Factorio list of backers with a list of English towns.
#!/bin/sh
BACKERS=data/core/backers.json
BACKUP=data/core/backers.bak.json
if [ ! -f "$BACKUP" ]
then
echo "Backing up backers.json.."
mv "$BACKERS" "$BACKUP"
fi
echo "Replacing backers.json.."
(
module trainsearch;
void main() {
int[][] paths;
// There are only six paths through the
// intersection that a train can take.
/*
paths ~= [2];
paths ~= [3];
paths ~= [4];
@FeepingCreature
FeepingCreature / counter.vhd
Created April 23, 2015 07:08
vhdl vga sample
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library altera;
use altera.altera_syn_attributes.all;
entity Counter is
generic (Size:Integer);
port (
Step, Reset: in std_logic;