Skip to content

Instantly share code, notes, and snippets.

View alpacaaa's full-sized avatar
🎱
Testing in production

Marco Sampellegrini alpacaaa

🎱
Testing in production
View GitHub Profile
@alpacaaa
alpacaaa / Cart.hs
Last active May 1, 2019 21:05
How purity in Haskell makes your life easier
module Cart where
-- An Item is just a record (like an object in JS).
data Item
= Item
{ name :: String
, quantity :: Int
}
@alpacaaa
alpacaaa / kafka-docs.pdf
Last active September 22, 2018 13:51
Kafka docs in pdf like it's 1995
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alpacaaa
alpacaaa / Explanation.md
Last active December 2, 2021 08:00
Hard things about ports being Tasks in Elm

evancz Mar 23, 2017 00:43
Just so folks are aware, one of the hard things about having ports just be a Task is the following. Right now, a Task is guaranteed to terminate with an error or a result. The only way it could be otherwise is if you have something of type Task Never Never Now, if you are calling out to random JS that is written by anyone, that guarantee goes away. You have to call some callback to give the value back to Elm, but what if that is never called? Maybe there's an error, maybe there is a weird code path. Now Elm code can "leak" tasks that never get completed because of problems in JS code. One way to protect against this is to have timeouts, such that there is some guaranteed end. My point here is just that it is more complicated than "what if it was a task?" and then everything would be nice.

Advanced Functional Programming with Scala - Notes

Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x

The Why and When of Choosing Elm

What is Elm?

  • Language (and "framework") for building web frontend applications
  • Can be used in place of HTML, CSS and JavaScript
  • Compiles into the above

The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming Workshop for All!

John A. De Goes — @jdegoes


Agenda

  • Functions
  • Types, Kinds, & More Functions
  • FP Toolbox
import React from 'react';
import { render } from 'react-dom';
import yup from 'yup';
import Form from 'react-formal';
const schema = yup.object({
test: yup.string()
});
@alpacaaa
alpacaaa / README.md
Created December 10, 2014 02:47
Beatport downloader

Isn't it crazy

That motherfucking Beatport doesn't let you download tracks in bulk? Why Beatport WHY?

@alpacaaa
alpacaaa / INSTALL.md
Created October 14, 2013 20:34
Installing Ghost Blogging platform

Installing Ghost is much more complicated than it is described in the docs. Here are a few additional steps needed do get it up and running.

####Clone the git repository I cannot get to work any of the random releases files I've downloaded, so start off with a fresh repo and follow the few steps that the guide actually provides.

git clone https://github.com/TryGhost/Ghost.git ghost
cd ghost
npm install
npm start
@alpacaaa
alpacaaa / nearestGitFolder.js
Last active December 16, 2015 05:49
Bash script to switch directory to the nearest .git folder
// .bash_aliases
// alias cdg='cd `node /path/to/script/nearestGitFolder.js`'
var fs = require('fs');
var hasGitDir = function(path) {
return fs.existsSync(path + '/.git');
}