Skip to content

Instantly share code, notes, and snippets.

View tmcgilchrist's full-sized avatar
👹

Tim McGilchrist tmcgilchrist

👹
View GitHub Profile
@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@juandazapata
juandazapata / mountain_lion_home_brew.md
Created July 26, 2012 15:07
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

After upgrading to Mountain Lion, I got this message when trying to run my local rails server:

Installing rmagick (2.13.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    Users/user/.rvm/rubies/ruby-1.9.3-rc1/bin/ruby extconf.rb
@markhibberd
markhibberd / characters.md
Last active January 14, 2021 18:32
Haskell Character Data

Overview

There are lots of representations for strings. In most languages they pick one set of tradeoffs and run with it. In haskell the "default" implementation (at least the one in the prelude) is a pretty bad choice, but unlike most other languages (really) good implementations exist for pretty much every way you can twist these things. This can be a good thing, but it also leads to confusion, and frustration to find the right types and how to convert them.

Types

@avdi
avdi / gol.exs
Last active June 3, 2016 04:30
Game of life in Elixir (take 1)
defmodule Life do
def run(board) when is_binary(board) do
board |> parse_board |> run
end
def run(board) do
IO.write("\e[H\e[2J")
Life.print_board board
:timer.sleep 1000
board = next_board(board)
(* Functor SortedList.Make resembling Map.Make and Set.Make
it is an artificial data structure similar to the normal list, but keeps elements sorted
*)
module type ORD = sig
type t
val compare : t -> t -> int
end
@paf31
paf31 / node-haskell.md
Last active April 14, 2021 18:42
Reimplementing a NodeJS Service in Haskell

Introduction

At DICOM Grid, we recently made the decision to use Haskell for some of our newer projects, mostly small, independent web services. This isn't the first time I've had the opportunity to use Haskell at work - I had previously used Haskell to write tools to automate some processes like generation of documentation for TypeScript code - but this is the first time we will be deploying Haskell code into production.

Over the past few months, I have been working on two Haskell services:

  • A reimplementation of an existing socket.io service, previously written for NodeJS using TypeScript.
  • A new service, which would interact with third-party components using standard data formats from the medical industry.

I will write here mostly about the first project, since it is a self-contained project which provides a good example of the power of Haskell. Moreover, the proces

@lindaliukas
lindaliukas / gist:53429e85e1d36ae81e20
Last active August 29, 2015 14:15
Principles of play links
@caseywdunn
caseywdunn / docker.md
Last active August 10, 2023 18:13
Docker cheat sheet

Docker cheat sheet

Introduction

Docker is a tool for bundling together applications and their dependencies into images that can than be run as containers on many different types of computers.

Docker and other containerization tools are useful to scientists because:

  • It greatly simplifies distribution and installation of complex work flows that
@ChrisPenner
ChrisPenner / Battleship.lhs
Last active September 10, 2023 03:12
Hit! You sunk my Adjunction!
Today we'll be looking into Kmett's
[adjunctions](http://hackage.haskell.org/package/adjunctions) library,
particularly the meat of the library in Data.Functor.Adjunction.
This post is a literate haskell file, which means you can load it right up in
ghci and play around with it! Like any good haskell file we need half a dozen
language pragmas and imports before we get started.
> {-# language DeriveFunctor #-}
> {-# language TypeFamilies #-}
@troyfontaine
troyfontaine / 1-setup.md
Last active March 28, 2024 23:11
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.