Skip to content

Instantly share code, notes, and snippets.

@kofifus
kofifus / gist:9360bdf9d98925c2e6ab6ccba4fa18ad
Created August 23, 2021 02:47
HttpFile GetToFileAsync, GetToStringAsync, PostToStringAsync
namespace System.Net.Http {
// holds the non disposable parts of HttpResponseMessage
public record HttpResponseInfo(HttpResponseHeaders Headers, bool IsSuccessStatusCode, string? ReasonPhrase, HttpStatusCode HttpStatusCode, HttpResponseHeaders TrailingHeaders, Version Version);
// holds Http exception information
public record HttpExceptionInfo(string ErrorMessage, WebExceptionStatus? WebExceptionStatus);
public record HttpResponse {
public HttpResponseInfo? HttpResponseInfo { get; init; }
@kofifus
kofifus / MarketplaceFilterLastHour.md
Last active January 31, 2023 05:17
Filter Facebook Marketplace to only show entries in the last hour
@kofifus
kofifus / README-Template.md
Created August 26, 2018 08:49 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Going over the usually recommended 'classes' solutions I ended up dissatisfied with all of them, mainly:
- using ES6 class, I have no real private variables/methods and my code is full with this._ which is really ugly
- using the crockford way, private methods have this unaassigned (or ===window) which is very confusing and
error prone and need the 'that=this' hack thing to work properly
- other soloutions ie weakmaps and symbols create complicated ugly code
- in any of the above ways it is hard to have a clear view of the public interface of the class
@kofifus
kofifus / Codemirror spellchecker with typo corrections
Last active May 16, 2024 13:05
CodeMirror spell checker with typo correction
usage:
------
// include codemirror.js, addon/mode/overlay.js
// include async typo.js from https://github.com/cfinke/Typo.js/pull/45
// include loadTypo.js from: https://github.com/cfinke/Typo.js/pull/50
// loading typo + dicts takes a while so we start it first
// hosting the dicts on your local domain will give much faster loading time
// english dictionaries taken from https://github.com/cfinke/Typo.js/pull/47