Skip to content

Instantly share code, notes, and snippets.

View Javascript 'class' pattern
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 / README-Template.md
Created Aug 26, 2018 — forked from PurpleBooth/README-Template.md
A template to make good README.md
View README-Template.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

@kofifus
kofifus / MarketplaceFilterLastHour.md
Last active Jun 16, 2021
Filter Facebook Marketplace to only show entries in the last hour
View MarketplaceFilterLastHour.md
@kofifus
kofifus / gist:9360bdf9d98925c2e6ab6ccba4fa18ad
Created Aug 23, 2021
HttpFile GetToFileAsync, GetToStringAsync, PostToStringAsync
View gist:9360bdf9d98925c2e6ab6ccba4fa18ad
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 / Codemirror spellchecker with typo corrections
Last active Sep 23, 2022
CodeMirror spell checker with typo correction
View Codemirror spellchecker with typo corrections
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