Skip to content

Instantly share code, notes, and snippets.

View Codesleuth's full-sized avatar

David Wood Codesleuth

View GitHub Profile
module Main where
import Test.Hspec
someNumbers2 :: [Int]
someNumbers2 = 1:2:3:[]
-- someNumbers3 = 4:5:[1,2,3]
mapList2 :: (Int -> Int) -> [Int] -> [Int]
@Codesleuth
Codesleuth / fizzbuzz.fs
Last active August 29, 2015 13:56
FizzBuzz in F# (work in progress)
module FizzBuzzFSharp.``FizzBuzz in F#``
open NUnit.Framework
open FsUnit
let fizzbuzz n =
match n with
| n when n % 15 = 0 -> "fizzbuzz"
| n when n % 5 = 0 -> "buzz"
| n when n % 3 = 0 -> "fizz"
@Codesleuth
Codesleuth / install.md
Last active August 29, 2015 13:56
A Widen GitHubs Userscript to widen the display of GitHub.

How To Install

  1. Browse to chrome://extensions in a non-incognito window.
  2. Drag the file widengithubs.user.js onto the window (the extensions list).
  3. Accept the security warning. Please review the script to determine that we are not, in fact, installing a malicious script.
  4. Find the script in the list and tick the "Allow in incognito" box for the script.
  5. Profit.
@Codesleuth
Codesleuth / fizzbuzz.erl
Last active August 29, 2015 13:58
FizzBuzz in Erlang to teach myself the syntax.
% Run tests with: erlc fizzbuzz.erl && erl -noshell -pa ebin -eval "eunit:test(fizzbuzz, [verbose])" -s init stop
-module(fizzbuzz).
-compile(export_all).
-include_lib("eunit/include/eunit.hrl").
fizzbuzz(N) when N rem 15 == 0 -> fizzbuzz(3) ++ fizzbuzz(5);
fizzbuzz(N) when N rem 3 == 0 -> "fizz";
fizzbuzz(N) when N rem 5 == 0 -> "buzz";
fizzbuzz(N) -> integer_to_list(N).
@Codesleuth
Codesleuth / .bashrc
Last active August 29, 2015 14:00
My dotfiles
#! /bin/bash
# functions
vscode() {
# opens Visual Studio Code with the specified parameters
VSCODE_CWD=$PWD
$USERPROFILE/AppData/Local/Code/Update.exe --processStart Code.exe -a="$*"
}
# aliases
package main
import dispatch._, Defaults._
object DispatchMessage extends App {
def DispatchRequest(reference: String, body: String, to: String): scala.xml.Elem = <messages>
<accountreference>{ reference }</accountreference>
<message>
<to>{ to }</to>
@Codesleuth
Codesleuth / Preferences.sublime-settings
Last active August 29, 2015 14:22
Sublime Text Settings
{
"font_size": 11,
"index_exclude_patterns":
[
"**\\node_modules*",
"*.log"
],
"phoenix_color_green": true,
"phoenix_sidebar_tree_large": true,
"phoenix_solid_current_tab": true,
@Codesleuth
Codesleuth / Trello-Card-ID.js
Last active August 29, 2015 14:22
Trello Card ID Userscript
// ==UserScript==
// @name Trello Card ID
// @namespace http://www.codesleuth.co.uk/
// @version 0.1
// @description Adds card IDs to Trello cards
// @author David Wood (david.p.wood@gmail.com)
// @match https://trello.com/*/*/*
// @grant none
// ==/UserScript==
@Codesleuth
Codesleuth / get-win7-productkey.vbs
Last active August 29, 2015 14:26 — forked from eyecatchup/get-win7-productkey.vbs
VBS Script to get the Windows(R) 7 Product Key from a PC's registry.
' VBS Script to get the Windows(R) 7 Product Key from a PC's registry.
'
' Save the VBScript as "getWin7Key.vbs" somewhere on your Windows7 PC.
' Now, when you double-click the local script file an alertbox pops up
' displaying the product key stored in the machine's Windows registry.
Set WshShell = WScript.CreateObject("WScript.Shell")
KeyPath = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"
MsgBox ExtractKey(WshShell.RegRead(KeyPath))
@Codesleuth
Codesleuth / proxy.go
Created August 8, 2015 13:18
Go HTTP Proxy
package main
import (
"fmt"
"net/http"
"net/http/httputil"
)
func HttpRouteHandler(responseWriter http.ResponseWriter, request *http.Request) {