Skip to content

Instantly share code, notes, and snippets.

View mausworks's full-sized avatar

Rasmus Wennerström mausworks

View GitHub Profile
@mausworks
mausworks / cs-formatting-parameters.md
Created December 1, 2020 09:23
C# formatting parameters (or arguments)

The reasoning for formatting parameters this way is so that we can intepret the argument list as one continous thing, without having to spend time aligning things.

The short cases

DO THIS

public static string Stringify(
 SomeLongTypeName someLongTypeName, int repeat)
import 'dart:async';
class Game {
String id = null;
Duration tickDuration = const Duration(microseconds: (1000000 ~/ 60));
DateTime updated = DateTime(0);
Timer _timer = null;
Game(String this.id);
@mausworks
mausworks / human-id.js
Last active October 18, 2019 09:14
Generate an easy to interpret ID.
/**
* The characters which will be used in the ID.
* Note that similar characters such as 0 and O are removed.
*/
const CHARACTERS = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
const ID_LENGTH = 5;
const randomCharIndex = () => Math.floor(Math.random() * CHARACTERS.length);
const getRandomChar = () => CHARACTERS[randomCharIndex()];
@mausworks
mausworks / BasicAuthentication.cs
Last active February 22, 2018 16:19
A functional helper class for Basic authentication. For tests, check out: https://gist.github.com/mausworks/37ba3aa9d3aeb3625b2eda196a0f1796
public class BasicAuthentication
{
public const string Scheme = "Basic";
public const char DelimiterSymbol = ':';
public string Username { get; }
public string Password { get; }
@mausworks
mausworks / trolling-scammers.md
Last active April 6, 2017 21:14
When they prey on your naivity— I prey on theirs.

Chase <3 also wants me to join their tournament.

Chase <3: hi dude
Chase <3: what is your rank?
maus 「マウス」: Not sure.
maus 「マウス」: Wanna find out?
Chase <3: we have our own team we need to play in the tournament, we are missing one person
Chase <3: we have our own team we need to play in the tournament, we are missing one person
Chase <3: you can help us?
@mausworks
mausworks / Conciousness.md
Created January 3, 2017 18:32
A simple description of mind.
public abstract class Conciousness
{
    public abstract Action Handle(SensoryData sensoryData);
}