Skip to content

Instantly share code, notes, and snippets.

View ntrel's full-sized avatar

Nick Treleaven ntrel

  • London
View GitHub Profile
@joriki
joriki / Question4622699.java
Last active March 29, 2024 20:55
Place party guests at dinner tables so they all meet each other; see https://math.stackexchange.com/questions/4622699.
import java.util.Random;
public class Question4622699 {
final static int nrounds = 7;
final static int ntables = 5;
final static int nchairs = 4;
final static int npeople = ntables * nchairs;
final static Random random = new Random();
@schveiguy
schveiguy / d1ops.d
Last active June 14, 2022 16:30
D1 operator overloads
mixin template D1Ops() {
// binary operations
static foreach(op, d1;
["+" : "opAdd", "-" : "opSub", "*" : "opMul", "/" : "opDiv",
"%" : "opMod", "&" : "opAnd", "^" : "opXor", "|" : "opOr",
"<<" : "opShl", ">>" : "opShr", ">>>" : "opUShr", "~" : "opCat",
"in" : "opIn"]) {
static if(__traits(hasMember, typeof(this), d1))
alias opBinary(string s : op) = mixin(d1);
// _r version

ref T Function Parameters Accept R-Values

Field Value
DIP: TBA
Review Count: 0
Author: Manu Evans, Walter Bright, Andrei Alexandrescu
Status: Draft

Abstract

@codebrainz
codebrainz / gist:1494603
Created December 18, 2011 21:56
Windows Make file for Geany
########################################################################
# Geany Make file for Windows
# ===========================
#
# Simple instructions:
# --------------------
# - Download and install MinGW to C:\MinGW
# - Download and install GTK+ bundle to C:\GTK
# - Add `bin` dir of both of above to PATH environment variable
# - Change into the root of the Geany source code (this directory)