Skip to content

Instantly share code, notes, and snippets.

@ChrisPenner
ChrisPenner / Optics Cheatsheet.md
Last active April 12, 2024 14:24
Optics Cheatsheet
@SimonAlling
SimonAlling / algebraic.ts
Last active October 24, 2023 21:00
Algebraic Data Types in TypeScript
// Types:
type Just<T> = { Just: T }
type Nothing = {}
type Maybe<T> = Just<T> | Nothing
type Left<L> = { Left: L }
type Right<R> = { Right: R }
type Either<L, R> = Left<L> | Right<R>
// For convenience:
@alekseykulikov
alekseykulikov / index.md
Last active April 14, 2024 00:32
Principles we use to write CSS for modern browsers

Recently CSS has got a lot of negativity. But I would like to defend it and show, that with good naming convention CSS works pretty well.

My 3 developers team has just developed React.js application with 7668 lines of CSS (and just 2 !important). During one year of development we had 0 issues with CSS. No refactoring typos, no style leaks, no performance problems, possibly, it is the most stable part of our application.

Here are main principles we use to write CSS for modern (IE11+) browsers:

@danidiaz
danidiaz / _FP reading lists.md
Last active May 23, 2024 04:02
assorted reading lists

A series of reading lists mostly related to functional programming.

@kristopolous
kristopolous / hn_seach.js
Last active July 24, 2023 04:12
hn job query search
// Usage:
// Copy and paste all of this into a debug console window of the "Who is Hiring?" comment thread
// then use as follows:
//
// query(term | [term, term, ...], term | [term, term, ...], ...)
//
// When arguments are in an array then that means an "or" and when they are seperate that means "and"
//
// Term is of the format:
// ((-)text/RegExp) ( '-' means negation )
@jkr
jkr / numerical-reference.hs
Created August 23, 2014 12:56
Numerical references to sections in pandoc. To be used with `--number-sections`
{-# LANGUAGE PatternGuards #-}
{- This filter allows for numerical section references. It should be
used with "--number-sections", since it uses a similar numbering
scheme. It works by using the link notation: given a header with a
given id, we can refer to that number by using a link with `#` in it:
My Header {#my-header-id}
=========
@amoilanen
amoilanen / promisify_require.js
Last active April 1, 2021 13:54
Enhances 'require' from RequireJS with Promises API while preserving its original semantics. Now 'require' calls can be chained.
/*
* Enhances 'require' from RequireJS with Promises API while preserving its original semantics.
*/
(function() {
if (!Promise || !require) {
return;
}
import Text.Pandoc.JSON
import Text.Parsec
import Control.Applicative
import Data.Monoid
main :: IO ()
main = toJSONFilter index
index :: Maybe Format -> Inline -> [Inline]
index (Just (Format f)) c@(Code _ s) =
@staltz
staltz / introrx.md
Last active July 15, 2024 15:43
The introduction to Reactive Programming you've been missing
@z-------------
z------------- / querySelector-shorthand.js
Created April 7, 2014 03:11
Do $$(selector) instead of document.querySelector(selector). Just saves a lot of time.
var $$ = function(sel) {
return document.querySelector(sel);
}
var $$$ = function(sel) {
return document.querySelectorAll(sel);
}
// $$ is equivalent to querySelector
// $$$ is equivalent to querySelectorAll