Skip to content

Instantly share code, notes, and snippets.

View jakubfijalkowski's full-sized avatar

Jakub Fijałkowski jakubfijalkowski

View GitHub Profile
using System.ComponentModel;
using System.Globalization;
using System.Resources;
using System.Windows.Data;
public class TranslationSource
: INotifyPropertyChanged
{
private static readonly TranslationSource instance = new TranslationSource();
@jakubfijalkowski
jakubfijalkowski / sample.fs
Created January 21, 2016 18:56
Ridiculous perf difference in almost-the-same F# code
// Version A
let private renderTriangleAlways renderer ctx v1 v2 v3 c =
let ymin', aes = getAEs v1 v2 v3
let mutable ymin = ymin'
for ae1, ae2 in aes do
let ymax = ae1.YMax
for y = ymin to ymax - 1 do
let minX = int (min ae1.X ae2.X)
let maxX = int <| ceil (max ae1.X ae2.X)
@jakubfijalkowski
jakubfijalkowski / PDA.fsx
Last active January 26, 2016 18:44
Turing machine (basic model) & PDA simulation in F#, with some examples
open System
type State = int
type StackSymbol = char
type Symbol = char
let toString = List.toArray >> String
let second f (a, b) = (a, f b)
let safeTail = function | [] -> [] | _ :: rest -> rest
let toChars (s : string) = s.ToCharArray() |> Array.toList
@jakubfijalkowski
jakubfijalkowski / arxiv-search.js
Last active June 18, 2018 18:14
arXiv search for Chrome omnibar
javascript:window.open('https://arxiv.org/search/?query=' + '%s'.split(' ').map(encodeURI).join('+') + '&searchtype=all&order=-announced_date_first&size=50','_self');
FROM neilpang/acme.sh AS cert
ARG OVH_AK
ARG OVH_AS
ARG OVH_CK
# Re-export args as ENV
ENV OVH_AK=${OVH_AK}
ENV OVH_AS=${OVH_AS}
ENV OVH_CK=${OVH_CK}
@jakubfijalkowski
jakubfijalkowski / Dockerfile
Created January 13, 2019 19:41
Reverse-proxy yourself to the host
FROM neilpang/acme.sh AS cert
ARG OVH_AK
ARG OVH_AS
ARG OVH_CK
# Re-export args as ENV
ENV OVH_AK=${OVH_AK}
ENV OVH_AS=${OVH_AS}
ENV OVH_CK=${OVH_CK}
@jakubfijalkowski
jakubfijalkowski / keybase.md
Created February 12, 2019 21:41
keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@jakubfijalkowski
jakubfijalkowski / EFCoreConversions.cs
Created November 28, 2019 15:03
In EFCore3 custom ValueConverters don't force client-side evaluation!
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace EFCore.Conversions
@jakubfijalkowski
jakubfijalkowski / Auth.cs
Created January 18, 2021 16:38
LeanCode.Example Contracts
namespace LeanCode.Example.Core.Contracts
{
public static class Auth
{
public static class Roles
{
public const string User = "user";
}
public static class KnownClaims