Skip to content

Instantly share code, notes, and snippets.

@StephenWakely
StephenWakely / plan.xml
Created February 2, 2012 09:46
Query plan
This file has been truncated, but you can view the full file.
<ShowPlanXML xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan" Version="1.1" Build="10.50.1600.1">
<BatchSequence>
<Batch>
<Statements>
<StmtSimple StatementText=" SELECT [Param].[ParamValue] AS [BillableEntityID], [BillableEntity].[RootFolder], [BillableEntity].[ClientCode], [Person].[PersonID],&#xD;&#xA; [Person].[LegalName], [Person].[Titles], [Person].[GivenNames], [Person].[FamilyName], [Person].[Initials], [Person].[Qualifications], &#xD;&#xA; [Activity].[ActivityID],&#xD;&#xA; [BillableEntity].[DocumentManagerCode],&#xD;&#xA;&#xD;&#xA; [Person].[NINumber],&#xD;&#xA; [Person].[Awards] AS [RecipientAwards],&#xD;&#xA;&#xD;&#xA; [PracticePerson].[Formal] AS [FormalSalutation], [PracticePerson].[Informal] AS [InformalSalutation], [PracticePerson].[Personal] AS [PersonalSalutation],&#xD;&#xA; [PracticePerson].[Envelope] AS [EnvelopeSalutation], [Activity].[ActivityName], [PostalContact].[AddressLine1], [PostalContact].[AddressLine2],&#xD;&#xA; [PostalContact].[Addres
@StephenWakely
StephenWakely / selecttags.cljs
Created October 9, 2014 22:22
Select Tags Om component
(ns acme.selecttags
(:require-macros [cljs.core.async.macros :refer [go alt!]])
(:require [cljs.core.async :refer [put! <! >! chan timeout]]
[om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[acme.shared-controls :as shared]
[cljs-http.client :as http]
[acme.server :as server]
[clojure.string :as str]))
@StephenWakely
StephenWakely / output.lisp
Last active November 2, 2015 10:40
Logging monad in Common Lisp
(defun mkStr (&rest args)
(with-output-to-string (s)
(dolist (a args) (princ a s))))
(defclass Out ()
((output :accessor output
:initarg :output)
(result :accessor result
:initarg :result)))
@StephenWakely
StephenWakely / data.hs
Created November 6, 2015 15:18
Generate random data that is almost pronouncable
module Main where
import System.Random
import Data.Char
names :: [[Char]]
names = ["Onk", "Ponk", "Erk", "Wonk", "Plark", "Pan", "Ork",
"Plerk", "Sha", "Noc", "Toc", "Wop", "Pap", "Shn", "Agh",
"Pert", "Munk", "Shton", "a", "e", "i", "o", "u", "Gert", "Onx",
"Ink", "Mank"]
@StephenWakely
StephenWakely / group.lisp
Last active January 24, 2016 22:02
Group by in Common Lisp
(defun group-by (fn coll &key groupfn keyname valuename)
"Groups the collection by the results of calling fn on each element.
The results of calling groupfn on the elements are grouped together.
Returned is a property list of the keyname to valuename properties."
(labels ((get-item (item)
(if groupfn
(funcall groupfn item)
item))

Keybase proof

I hereby claim:

  • I am fungushumungus on github.
  • I am oogle (https://keybase.io/oogle) on keybase.
  • I have a public key ASAd3GQj-Avl2tdSJixNrzFG3vuyDNHq_iSw8sJKG23eyAo

To claim this, I am signing this object:

@StephenWakely
StephenWakely / main.hs
Created January 31, 2019 11:27
Generate purescript file from fontawesome
{-# LANGUAGE OverloadedStrings #-}
module Lib
( someFunc
) where
import System.IO
import Data.Char
import Data.Text (Text)
import qualified Data.Text as T
-- | Code for calculating the levenstein distance between two strings
module Data.Levenstein (distance) where
import Prelude
import Data.Array as Array
import Data.Array ((!!))
import Data.Function.Memoize (memoize2)
import Data.Maybe as Maybe
-- | A variable
-- x.y[3].z[2][9]
variableParser :: Parser Var
variableParser = do
pos <- getSourcePos
var <- parseSimpleVar pos <?> "Simple var"
go var
where
@StephenWakely
StephenWakely / polyservant.hs
Last active December 1, 2019 18:04
Servant with Polysemy
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
-- |