Skip to content

Instantly share code, notes, and snippets.

View enricopolanski's full-sized avatar

Enrico Polanski enricopolanski

View GitHub Profile
@enricopolanski
enricopolanski / types.ts
Created December 12, 2020 16:52 — forked from ClickerMonkey/types.ts
Typescript Helper Types
// when T is any|unknown, Y is returned, otherwise N
type IsAnyUnknown<T, Y, N> = unknown extends T ? Y : N;
// when T is never, Y is returned, otherwise N
type IsNever<T, Y = true, N = false> = [T] extends [never] ? Y : N;
// empty object
type EmptyObject = { [key: string]: never };

On hiring Haskellers

Recently I noticed the number of the same two questions being asked again and again on different Haskell resources. The questions were “How to get a Haskell job” and “Why is it so hard to find Haskellers?” Although these two are coming from the opposite sides of the hiring process, the answer is really just one. There is a single reason, a single core problem that causes difficulties of hiring and being hired in the Haskell community, and we should clearly articulate this problem if we want to increase the Haskell adoption.

We all know that there are many people wishing to get a Haskell job. And a visible increase of Haskell jobs looks like there should be a high demand for Haskellers. The Haskell community has also grown like crazy past years. But still, why is it so difficult to hire and to be hired? Why can’t companies just hire any single person who demonstrates a deep knowledge of Haskell in blog posts, in chats, on forums, and in talks? And why do Haskell companies avoid hirin

@enricopolanski
enricopolanski / eq1.md
Last active May 25, 2020 12:36
Equivalence #1

Suppose we want a set of unique { x, y } points to plot on a graph.

this expression:

new Set([
  { x: 1, y: 1 },
  { x: 1, y: 1 },
]);
@enricopolanski
enricopolanski / cheatsheet.md
Created February 21, 2020 13:16 — forked from julekgwa/cheatsheet.md
Protractor API Cheatsheet with Examples
@enricopolanski
enricopolanski / README.md
Created September 22, 2019 23:16 — forked from acutmore/README.md
Emulating a 4-Bit Virtual Machine in (TypeScript\JavaScript) (just Types no Script)

A 4-Bit Virtual Machine implemented in TypeScript's type system. Capable of running a sample 'FizzBuzz' program.

Syntax emits zero JavaScript.

type RESULT = VM<
  [
    ["push", N_1],         // 1
    ["push", False],       // 2
 ["peek", _], // 3
@enricopolanski
enricopolanski / main.ts
Created June 14, 2019 16:18
Functional JS/TS
// A Functor is "something" we can map: to be specific it is a mapping between categories that preserves the categorical structure, i.e. that preserve identity morphisms and composition.
// Since categories are constituted of two things (objects and morphisms) a functor is constituted of two things as well:
// - a mapping between objects that associates to each object x in C an object in D
// - a mapping between morphisms that associates to each morphism in C a morphism in D
Array, Tree, Stream, Promise are all functors, we can map all of them.
try {
const decodedString = [stringWithoutNonUnicode]
.map(splitByWhitespace)[0]
.map(replaceWithOriginal(listOfDecodedWords))
.join("")
.replace(/./g, (char, index) =>
!unicodeWord.test(char) ? str[index] : char
);
console.log(decodedString);
const express = require('express')
const cool = require('cool-ascii-faces')
const app = express()
const port = 3000
const redditAnswerHTML =
`<div style="height:100%;width:100%;display:flex;justify-content:space-around;align-content:center">
<div style="height:100%;display:flex;justify-content:space-around;align-content:center;margin-top:32px;font-size:32px;font-weight:400;color:gray">${cool()}</div>
<div style="width:50%;margin-top:32px;font-size:32px;font-weight:400;font-family:Arial">
Because unless you're not hitting thousands+ of requests per second, but even then scaling is pretty trivial, writing backend in node is fast, easy cheap and accessible.

//

heroku login // logins heroku create // creates a new app in local dir git push heroku master // pushes stuff from heroku to master heroku ps:scale web=1 // ensures at leasy a dyno is active, idk heroku open // opens the app heroku logs --tail heroku local web