Skip to content

Instantly share code, notes, and snippets.

Working from home

Nick Brady nick-brady

Working from home
Block or report user

Report or block nick-brady

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
nick-brady /
Created Apr 1, 2018
A terminal battleship implementation to practice object oriented concepts
from random import randint
from time import sleep
# ALG_DEBUG = True
def blue(string):
return '\x1b[0;34;40m' + string + '\x1b[0m'
def green(string):
nick-brady /
Last active Mar 20, 2018
dumb script for writing the boilerplate javascript to log out the arguments in a function
# python arg1, arg2, arg3, arg4
import sys
def cleanString(string):
if string[-1] == ',':
return string[:-1]
return string
View query-string-parser.js
* modified code of gist -
* - newer syntax
* - decodeURIComponent instead of generic decoding function (unescape)
* keys with name name defined after will take priority
export function parseQueryString(location) {
const query = decodeURIComponent(location).trim();
const obj = {};
const qPos = query.indexOf('?');
nick-brady /
Last active Jul 17, 2017
simple Python implementation of Dijkstra's Algorithm
from collections import defaultdict
import math
class DirectedGraph(dict):
"""Create a directed Graph. Root keys contain a dictionary of other nodes they are directed to with
corresponding weight"""
def __missing__(self, key):
value = self[key] = {key: 0} # A keys distance to itself is always 0
return value
You can’t perform that action at this time.