Skip to content

Instantly share code, notes, and snippets.

Avatar

Jim Kirkbride jameskbride

View GitHub Profile
@jameskbride
jameskbride / load_aws_credentials.sh
Created May 26, 2018
Load AWS credentials into environment variables
View load_aws_credentials.sh
env AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id) AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key)
@jameskbride
jameskbride / README.md
Last active Apr 15, 2019
Tetris Kata
View README.md

Tetris Kata

This kata is intended to simulate a game of Tetris.

The point of this kata to to provide a larger than trivial exercise that can be used to practice TDD. A significant portion of the effort will be in determining what tests should be written and, more importantly, written next.

Considerations:

  • Multi-threading should not be a consideration. This should be done in a single thread.
  • Drawing the board is a bonus feature, and is not required in order to solve the problem.
  • For the purpose of the kata we do not need a true "game loop". We simply need to implement the rules in such a way as to advance the game state.
@jameskbride
jameskbride / least-resistance.md
Created Jul 4, 2016
Path of Least Resistance Kata
View least-resistance.md

Path of Least Resistance

The Challenge

Energy flows through the path of least resistance. For this challenge, you are provided a grid of integers where each integer represents the amount of resistance encountered at a given point on the grid. Energy enters the grid from the left (at any point) and passes through the grid to the right, moving only one column per round.

Programming Challenge

Movement is always to an adjacent row, meaning energy can flow horizontally or

View trend_kata.md

Trend Kata

The trend kata is an exercise in determining the 'trend' of a series of numbers. The algorithm is weighted towards non-zero values and numbers in the series that are changing. A value of zero and numbers in sequence that are the same value, are given less weight in the calculation. The algorithm will be a summing of results, for each pair within the list, shifted by one (1).

This algorithm, will expect a list of numbers... whole numbers and/or decimals.

  • if the supplied list is empty or does not exist (null), then the trend calculator should return null.
  • if the list contains only a single value, then the trend calculator should return a value of zero (0).
  • the resulting trend will always start with a value of zero (0).
  • the first pair will contain the first two numbers in the list
@jameskbride
jameskbride / .gitconfig
Last active Dec 25, 2015
git tree alias
View .gitconfig
[alias]
tree = log --pretty=format:'%Cgreen%h%Creset -%C(auto)%d%Creset %s %C(cyan)<author:%an | committer:%cn>%Creset' --graph --color --all --decorate
View ShadowLocationManager.java
package com.groceryreminder.shadows;
import android.app.PendingIntent;
import android.location.LocationManager;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import java.util.ArrayList;
import java.util.List;
View vending_machine_kata.md

Vending Machine kata blatantly copied from Guy Royse (https://github.com/guyroyse/vending-machine-kata)

Vending Machine Kata

In this exercise you will build the brains of a vending machine. It will accept money, make change, maintain inventory, and dispense products. All the things that you might expect a vending machine to accomplish.

The point of this kata to to provide an larger than trivial exercise that can be used to practice TDD. A significant portion of the effort will be in determining what tests should be written and, more importantly, written next.

@jameskbride
jameskbride / Fixture.java
Created Jun 7, 2014
Testing Anti-Patterns: Fixture Example
View Fixture.java
@Test
public void givenTwoWidgetsWhenTheWidgetsAreQueriedThenTheCountIsTwo() {
WidgetQuery widgetQuery = new WidgetQuery();
assertEquals(2, widgetQuery.count());
}
View gitkeep
find . -type d -empty -exec touch {}/.gitkeep \;
@jameskbride
jameskbride / CMakeLists.txt
Last active May 23, 2018
Basic CMakeLists.txt for a "Hello, World!" C++ project. It shows the use of a library which contains the class file for the application.
View CMakeLists.txt
cmake_minimum_required (VERSION 2.8)
project (CMakeHelloWorld)
#version number
set (CMakeHelloWorld_VERSION_MAJOR 1)
set (CMakeHelloWorld_VERSION_MINOR 0)
#include the subdirectory containing our libs
add_subdirectory (Hello)
You can’t perform that action at this time.