Skip to content

Instantly share code, notes, and snippets.

View worldbeater's full-sized avatar
☦️

Artyom V. Gorchakov worldbeater

☦️
View GitHub Profile
@wcooley
wcooley / README.md
Last active April 3, 2023 14:35
Pytest: Ab(using) parametrize to alias long fixture names

Problem

I am testing an object with varied datasets, which I am creating as separate fixtures, so my fixture names become rather long due to encoding enough distinguishing characteristics so I can keep their purposes straight. I have to refer to my object a number of times throughout the test and futhermore there is a local convention for the name of the object in production code, so it makes sense to use the same short name in my tests. As a result, one of the very first things I do in the test is alias the long fixture name to the short conventional name, as can be seen in the assignment to foo in test_01_before.py. Whenever I do this, I wish to myself "it's too bad there isn't a way to express the fixture declaration/import with an alias

@mrange
mrange / on-tail-recursion.md
Last active July 18, 2024 07:24
On the topic of tail calls in .NET

On the topic of tail calls in .NET

Let's say you have implemented a small data pipeline library to replace LINQ.

module TrivialStream =
  type Receiver<'T> = 'T            -> unit
  type Stream<'T>   = Receiver<'T>  -> unit

  module Details =
namespace GlobalHotKey
{
public class GlobalKeyboardHookEventArgs : HandledEventArgs
{
public GlobalKeyboardHook.KeyboardState KeyboardState { get; private set; }
public GlobalKeyboardHook.LowLevelKeyboardInputEvent KeyboardData { get; private set; }
public GlobalKeyboardHookEventArgs(
GlobalKeyboardHook.LowLevelKeyboardInputEvent keyboardData,
GlobalKeyboardHook.KeyboardState keyboardState)
@XlogicX
XlogicX / games.md
Last active October 28, 2024 15:50
List of Boot Sector Gamers

Boot Sector Games

A list of playable boot sector games, most of which are on github. Fun to play, great to learn from. There are also many cool non-booting boot sectors out there that aren't games (so more like demos), but this page is just reserved to interactive boot sectors / games. This list is also not complete, but not on purpose, it is a best effort collection of games, so if you know of any fun boot sector games, please contribute.

This page lists a collection of 31 games spanning several authors: nanochess, me, daniel-e, shikhin, JulianSlzr, XanClic, QiZD90, darkvoxels, guyhill, w-shackleton, egtzori, VileR, ish_works, franeklubi, queso_fuego, franeklubi, Jethro82, waternine9, tevoran, palma3k, taylor-hartman. peterferrie should also be mentioned as he has touched a lot of these games.

TetrOS

https://github.com/daniel-e/tetros

Tetris Clone. Full color, no score. This was one of the older boot sector games out there. ![tetros](https://gist.github.com/assets/1570856/3a0d1023-cbe6-4b4d-

@dabeaz
dabeaz / lala.py
Last active August 20, 2024 07:20
Some lambdas
# Author: David Beazley (https://www.dabeaz.com)
# Twitter: @dabeaz
from functools import reduce
run = lambda s: reduce(lambda *_:..., iter(lambda s=[s]:
(_:=s.pop()(),s.append(_))[0], None))
const = lambda v,c : lambda: c(v)
add = lambda x,y,c : lambda: c(x+y)
mul = lambda x,y,c : lambda: c(x*y)
@nerodono
nerodono / JsonParser.hs
Last active April 23, 2024 22:53
JSON parser written in haskell: no adequate error checking, just JSON
module JsonParser where
import qualified Data.Map as M
import qualified Data.Bifunctor as Bi
import Data.Char ( ord
, chr
, isHexDigit
, isDigit
)