Skip to content

Instantly share code, notes, and snippets.

View gpampara's full-sized avatar

Gary Pamparà gpampara

  • Pretoria, South Africa
View GitHub Profile
@krisleech
krisleech / renew-gpgkey.md
Last active July 10, 2024 14:14
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

Take-home functional programming interview

This document is licensed CC0.

These are some questions to give a sense of what you know about FP. This is more of a gauge of what you know, it's not necessarily expected that a single person will breeze through all questions. For each question, give your answer if you know it, say how long it took you, and say whether it was 'trivial', 'easy', 'medium', 'hard', or 'I don't know'. Give your answers in Haskell for the questions that involve code.

Please be honest, as the interviewer may do some spot checking with similar questions. It's not going to look good if you report a question as being 'trivial' but a similar question completely stumps you.

Here's a bit more guidance on how to use these labels:

// https://groups.google.com/d/msg/scala-functional/NAMWgC90KLA/sU0rw7ceoQMJ
object ApplyUnapply {
import language.higherKinds // I laugh every time
/*
In order to define Prism, we must define:
@aryairani
aryairani / AsyncHttpTask.scala
Last active August 29, 2015 14:12
Rewritten AyncHttpClient example for Tim
/**
* Created by arya on 1/2/15.
*/
/*
scalaVersion := "2.11.4"
libraryDependencies += "com.ning" % "async-http-client" % "1.9.3"
libraryDependencies += "org.scalaz" %% "scalaz-concurrent" % "7.1.0"
import scalaz.{ Free, Coyoneda, Monad, ~>, State, NonEmptyList }
import scalaz.std.function._
import scalaz.syntax.monad._
import scalaz.effect.IO
import scala.util.Random
object freecoyo extends App {
// An algebra of primitive operations in the context of a random number generator
@donovanh
donovanh / gulpfile.js
Created July 28, 2014 21:01
Gulp file for Jekyll, with Sass, Autoprefixer, and browsersync
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
@markhibberd
markhibberd / argonaut.scala
Created January 3, 2014 03:05
argonaut union type example
package argonaut.example
import argonaut._, Argonaut._
import scalaz._, Scalaz._
object UnionExample extends {
sealed trait Thing
final case class One(n: String, i: Int) extends Thing
final case class Two(n: String) extends Thing
@pchiusano
pchiusano / retries.scala
Last active December 30, 2015 22:29
Combinator for retrying a `Process` multiple times, delaying between attempts
// FYI: some comments below refer to old version of this gist: https://gist.github.com/pchiusano/7894696/12201b92db57dff8ed6689fc55c15c3f1a136f86
package scalaz.stream
import scalaz.\/
import scalaz.concurrent.Task
object retries {
def dropWhileUnlessAtEnd[I](f: I => Boolean): Process1[I,I] = {
def go(prev: Option[I]): Process1[I,I] =
@shajra
shajra / Task.scala
Created August 23, 2013 03:34
integration code between Scalaz and Scala standard concurrency libraries.
import concurrent.{ExecutionContext, Future => SFuture, Promise}
import util.Try
import _root_.scalaz.\/
import _root_.scalaz.concurrent.{Task => ZTask}
object Task {
def fromScala[A]
@ms-tg
ms-tg / scala_try_monad_axioms.scala
Last active May 28, 2022 03:48
Scala Try: monad axioms
import scala.util.{Try, Success, Failure}
def f(s: String): Try[Int] = Try { s.toInt }
def g(i: Int): Try[Int] = Try { i * 2 }
def unit[T](v: T): Try[T] = Success(v)
//val v = "1"
val v = "bad"
val m = Success(v)