Skip to content

Instantly share code, notes, and snippets.

View kittsville's full-sized avatar
🦆
Scala? Never heard of er

Kit kittsville

🦆
Scala? Never heard of er
View GitHub Profile
import scala.annotation.tailrec
// A lil class to make the code neater
case class Coordinate(x: Int, y: Int)
@tailrec
def diagonal(matrix: List[List[Int]], coordinate: Coordinate, previousPath: List[Int] = List.empty)
: List[Int] = {
val path = previousPath :+ matrix(coordinate.y)(coordinate.x)
val nextCoordinates = Coordinate(coordinate.x + 1, coordinate.y + 1)

Keybase proof

I hereby claim:

  • I am kittsville on github.
  • I am kittsville (https://keybase.io/kittsville) on keybase.
  • I have a public key ASB7KhYSlXYY5zC0yRzP974SMF5kdkixYlBsjOqqFLwHlgo

To claim this, I am signing this object:

# To run tests in test suite with exact same name
testOnly uk.sci1.foo.FooTestSuiteSpec -- -t "Name of my specific test"
# Alternatively
testOnly *FooTestSuiteSpec -- -t "Name of my specific test"
# To run tests in suite with substring "Bar"
testOnly uk.sci1.foo.FooTestSuiteSpec -- -z "Bar"
# To re-run the tests on every file change
~ testOnly [your query here]
'body':
'ctrl-tab ^ctrl': 'unset!'
'ctrl-tab': 'pane:show-next-item'
'ctrl-shift-tab ^ctrl': 'unset!'
'ctrl-shift-tab': 'pane:show-previous-item'
'ctrl-alt-s': 'window:save-all'
@kittsville
kittsville / RandomSerializable.php
Last active June 16, 2016 15:17
Generates a random serializable value such as a string, boolean or array
<?php
/**
* Random Serializable
* @author Kit Maywood
* @licence WTFPL
* @version 1.0
*
* Generates a random serializable value such as a string, boolean or array.
* Arrays themselves contain random serializable values
* I realised how stupid this was but decided to finish it anyway
@kittsville
kittsville / httpd-app.conf
Last active September 7, 2016 22:32
Apache config for local development builds
<VirtualHost *:80>
ServerName sitename.localhost
ServerAlias www.sitename.localhost
DocumentRoot C:/xampp/apps/sitename/htdocs
<Directory "C:/xampp/apps/sitename/htdocs">
Options -MultiViews +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
@kittsville
kittsville / Bulk Flair Upload.js
Last active May 4, 2016 10:16
Allows bulk adding of subreddit user flair templates from a text file
/**
* Bulk Flair Upload
* Version 0.1
* Author: @kittsville
* Allows bulk adding of user flair templates from a text file
* Only supports flair name, not CSS class
*/
if (!window.FileReader || ![].forEach) {
throw "Your browser sucks so this won't work";
}
@kittsville
kittsville / Git Aliases
Last active July 25, 2017 13:37
Helpful Git Aliases
/**
* git wipe
* Removes all uncommitted changes and untracked files/folders
*/
git config --global alias.wipe '!git reset --hard && git clean -fd'
/**
* git undo
* Removes the last commit but leaves all its changes.
* Really useful if you fuck-up the commit message
@kittsville
kittsville / Haskell Assessment.hs
Last active April 30, 2016 14:00
CS3518 Haskell Assessment 2016
-- ## HELPERS ##
-- General purpose functions used in multiple answers to avoid duplicate code
-- 1. count
-- Counts occurrences of given input in given list of inputs.
--
-- Preconditions:
-- List must be finite
count :: (Eq a) => [a] -> a -> Int