Skip to content
View gist:c48124b5431cdda5aab4
[ { id: '46642', val: 10898, name: 'r-martinho-fernandes' },
{ id: '16102', val: 9558, name: 'cat-plus-plus' },
{ id: '298661', val: 4516, name: 'puppy' },
{ id: '174614', val: 4261, name: 'tony-the-lion' },
{ id: '85371', val: 4167, name: 'sehe' },
{ id: '252000', val: 4069, name: 'fredoverflow' },
{ id: '1804599', val: 4018, name: 'elyse' },
{ id: '71141', val: 3657, name: 'etienne-de-martel' },
{ id: '500104', val: 3544, name: 'xeo' },
{ id: '140719', val: 3508, name: 'sbi' },
View image_codomain.md

Why is the codomain useful?

In set theory we have that a domain is the set of all inputs for which a function is defined and the image is the set of possible outputs given those inputs. You would think this would be enough, but no: we also have the concept of codomain, which is the set of all possible outputs and some.

This also leads to the distinction between "surjective" functions and non-"surjective" functions (functions that have the image being equal to the codomain and those that don't, respectively). This distinction seems to provide no useful information about the function itself.

Now, let's make an example, we have:

ƒ : {a, b, c, d} -> {1, 2, 3, 4}
ƒ a = 1
View avoid.md
  • lol
  • lel
  • kek
  • top kek
  • rotfl
  • lmao
  • yeah, no
  • no.
  • what
  • wat
View factorio_basic_rules.md

Factorio basic rules

  1. Don't be a dick
    • a. The player that hosts has to retrieve the most recent save
    • b. The player that originally hosted has to replace the old save with the new one at the end of the match
    • c. The player whose responsibility is to replace the old save can delegate the job to someone else upon agreement
  2. Destroying property requires consent to those that put it down
  3. Don't kill other players
  4. Autosave period must be set to 15 minutes
View driving_slots.sql
create view total_driving_slots as (
select week_day,
time,
count(id) as total_count
from driving_slots
group by week_day, time
);
create view free_driving_slots as (
select week_day,
View quick_sort.cpp
namespace detail {
template<typename It>
It partition(It begin, It end) {
if (begin == end) return end;
auto pivot = *(end - 1);
auto left = begin; // left partion past the end
for (auto right = begin; right != end; ++right) {
if (*right <= pivot) {
std::iter_swap(left, right);
View gist:7f6d4ce58edbceec5f16
#!/usr/bin/python
import ninja_syntax
import itertools
import os
import fnmatch
import re
import sys
import argparse

The asymmetries of C++

This is lighthearted collection of asymmetries of the C++ language. This is not, in any way, intended as a critic.


Partial specialization is allowed for class templates but not for function templates

§14.5.5 [temp.class.spec] describes the semantic and syntax for class template partial specialization such as, given:

View equal100.hs
-- Write a program that outputs all possibilities to put + or - or nothing
-- between the numbers 1, 2, ..., 9 (in this order) such that the result is
-- always 100. For example: 1 + 2 + 34 – 5 + 67 – 8 + 9 = 100.
import Control.Monad (replicateM)
ints :: [String]
ints = map (\i -> [i]) ['1'..'9']
inbetweens :: [[String]]
type alias Unit = Float
type Vec2 = Vec2 Unit Unit
(|+|) : Vec2 -> Vec2 -> Vec2
(Vec2 ax ay) |+| (Vec2 bx by) = Vec2 (ax + bx) (ay + by)
negate : Vec2 -> Vec2
negate (Vec2 x y) = Vec2 (-x) (-y)
(|-|) : Vec2 -> Vec2 -> Vec2
Something went wrong with that request. Please try again.