Skip to content

Instantly share code, notes, and snippets.

readBin :: String -> Integer
readBin [] = 0
readBin str = (readBin $ init str) * 2 + (read [last str])
parseBinNumber :: Parser LispVal
parseBinNumber = do char '#'
char 'b'
input <- many1 $ oneOf "01"
return $ Number $ readBin input
int fib(n) { return fib(n-1) * n }
int fib(0) { return 1; }
// Schwerkraft nach unten ↓
for (int col = 0; col < game.Field.GetLength(1); ++col)
{
int count = 0;
for (int row = game.Field.GetLength(0) - 1; row >= 0; --row)
{
if (game.Field[row, col] == ' ')
{
++count;
}
/* criteria query */ select
this_.id as id7_4_,
this_.datum as datum7_4_,
this_.gemeldet as gemeldet7_4_,
this_.menge as menge7_4_,
this_.sorte_id as sorte5_7_4_,
this_1_.weingarten_id as weingarten2_8_4_,
this_2_.lieferant_id as lieferant3_9_4_,
this_2_.preis as preis9_4_,
case
SELECT this_.id AS id7_4_ ,
this_.datum AS datum7_4_ ,
this_.gemeldet AS gemeldet7_4_ ,
this_.menge AS menge7_4_ ,
this_.sorte_id AS sorte5_7_4_ ,
this_1_.weingarten_id AS weingarten2_8_4_,
this_2_.lieferant_id AS lieferant3_9_4_ ,
this_2_.preis AS preis9_4_ ,
CASE
WHEN this_1_.id IS NOT NULL
BaseItem::BaseItem(const QString &name, const QString &namestr, const QString &code,
const QString &normcode, const QString &ubercode,
const QString &ultracode, const QString &type, int mindef,
int maxdef, int block, int mindam, int maxdam, int _2handmindam,
int _2handmaxdam, int minmisdam, int maxmisdam, int speed,
int reqstr, int reqdex, int levelreq, int durability,
bool nodurability, int invwidth, int invheight, int gemsockets,
int gemapplytype) :
_name(name),
CC=clang
CFLAGS=-c -std=c99 -Wall -pedantic -O3 # Release
#CFLAGS=-c -std=c99 -Wall -pedantic -O0 -g # Debug
LD=clang
LDFLAGS=
RM=rm
RMFLAGS=-rf
Not shown: 65530 closed ports
PORT STATE SERVICE
21/tcp open ftp
80/tcp open http
1690/tcp open unknown
1720/tcp filtered H.323/Q.931
10000/tcp open snet-sensor-mgmt
5-10 KLoC is an important waterline. In a 500 LoC throwaway, it's easy to juggle strings back and forth between loosely structured dictionaries and barely organized arrays while keeping mutable global state in randomly picked places and still get away with it safely1. 5-10 KLoC is when such soup becomes unmanageable and that's when author begins to shape it into crisp domain objects and clearly defined design patterns.
-- http://antiblog.geekyfox.net/entry/proper-typing
///// IMPLEMENTATION BELOW
// (If you want to build this just move main at the end of the file)
int main()
{
using namespace std;
vector<int> vi{2,5,7,45,3,45,6,7,8,7,6,5,3,2,5,8};
sort(begin(vi), end(vi), comparing([](int &a) { return make_tuple(a % 5, a); }));