Skip to content

Instantly share code, notes, and snippets.

Avatar

Oskar Wickström owickstrom

View GitHub Profile
@owickstrom
owickstrom / cp11-async-curl.cpp
Created July 31, 2012 16:47
C++11 Async cURL
View cp11-async-curl.cpp
#include <iostream>
#include <curl/curl.h>
#include <math.h>
#include <vector>
#include <future>
#include <boost/format.hpp>
#define logbase(a, b) (log(a)/log(b))
using namespace std;
@owickstrom
owickstrom / .gitignore
Created October 17, 2012 07:52
A simple Continuous Integration and Deployment workflow with ASP.NET MVC, GitHub and Jenkins
View .gitignore
# Ignore dot-files, except the .gitignore file.
.*
!.gitignore
# (All rules from CSharp.gitignore)
@owickstrom
owickstrom / TodoMVC.spec.purs
Last active March 12, 2021 01:19
TodoMVC Showdown Specification
View TodoMVC.spec.purs
module WebCheck.PureScript.TodoMVC where
import WebCheck.DSL
import Data.Array (filter, foldMap, head, last, zip)
import Data.Foldable (length)
import Data.Int as Int
import Data.Maybe (Maybe(..), fromMaybe)
import Data.String (Pattern(..), split, trim)
import Data.Tuple (Tuple(..))
@owickstrom
owickstrom / selective.md
Created July 4, 2020 20:04
Questions regarding selective applicative functors and WebCheck's DOM query restrictions
View selective.md

Selective Applicative Functors in WebCheck

WebCheck uses a version of PureScript for specifications in testing web applications, which I'll refer to as "the language" in this document.

A specification includes a top-level definition called proposition, which must be a pure expression of type Boolean. The interpreter of the language does not allow effects (the Effect type in PureScript, formerly known as Eff). But there are a few built-in constructs that are at least backed by non-pure computations:

@owickstrom
owickstrom / cla.md
Last active August 22, 2020 05:28
Quickstrom CLA
View cla.md

Contributor Agreement

Individual Contributor exclusive License Agreement

(including the Traditional Patent License OPTION)

Thank you for your interest in contributing to Oskar Wickström's Quickstrom ("We" or "Us").

The purpose of this contributor agreement ("Agreement") is to clarify and document the rights granted by contributors to Us.

@owickstrom
owickstrom / state.ex
Last active July 28, 2020 20:52
Exposing a synchronous API in Elixir. Inspired by http://elixir-lang.org/getting_started/mix_otp/3.html.
View state.ex
defmodule State.Counter do
use GenServer
def start_link(opts \\ []) do
GenServer.start_link(__MODULE__, :ok, opts)
end
## Client API
@doc "Gets the counter's current value."
View ThoughtLeaderTom.hs
{-# OPTIONS_GHC -Wno-missing-methods #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module ThoughtLeaderTom where
import Control.Monad ((>=>))
@owickstrom
owickstrom / gist:3072696
Created July 8, 2012 20:34
Aliases in Scala pattern matching
View gist:3072696
// If we have a Person class like this...
case class Person(firstName : String, lastName : String)
// ... and we want to use pattern matching to ensure
// an object is a Person with lastName "Jones" before
// send it to someFunction, we could do something like
// this:
someObject match {
@owickstrom
owickstrom / HiggledyHedgehog.hs
Created July 1, 2019 19:37
Defining overridable default generators for Hedgehog using Higgledy
View HiggledyHedgehog.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE TypeApplications #-}
module HiggledyHedgehog where
import Control.Lens
import Data.Generic.HKD
import GHC.Generics (Generic)
import Hedgehog
View TypeFamilyConstraintsTuple.hs
-- | This shows a way of computing a recursive type, and applying
-- constraints to individual types within it, using a type family.
-- I've commented the different parts, and the file ends with some
-- questions.
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}