Skip to content

Instantly share code, notes, and snippets.

View a-r-d's full-sized avatar
🍌

Aaron Decker a-r-d

🍌
View GitHub Profile
@a-r-d
a-r-d / BfsShortestDijkstra.java
Created September 27, 2015 20:30
Shortest path problem on hacker rank using Dijkstra algorithm
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;
public class BfsShortestDijkstra {
public static class Node implements Comparable<Node>{
@a-r-d
a-r-d / NQueensBacktracking.java
Created September 20, 2015 07:34
Some experimenting with N-Queens problem
import java.util.Arrays;
public class NQueensBacktracking {
public static void main(String[] args) {
greedyRunner(8);
greedyRunner(10);
greedyRunner(15);
greedyRunner(20);
greedyRunner(22);
@a-r-d
a-r-d / StackWithMinVal.java
Created September 13, 2015 21:53
A java class that is a generic stack data structure that tracks the min value.
package hackerrank;
public class StackWithMinVal {
public class Node<T extends Comparable<T>> {
public T value;
public Node<T> prev;
@Override
public String toString() {
@a-r-d
a-r-d / BalanceDelimiters.java
Last active September 13, 2015 20:15
Just a common interview problem for balancing parens using a stack.
package derp;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Stack;
public class BalanceDelimiters {
@a-r-d
a-r-d / get-markit-data.py
Last active October 3, 2015 03:05
Pull data from markitondemand and send it to my arduino's LCD screen that sits above my dining room table.
import time
import math
import urllib2
import json
import traceback
ser = None
MARKIT_PAUSE = 3
#MOUNT = "/dev/ttyACM0" #raspi
MOUNT = "COM3" #windows
@a-r-d
a-r-d / Dockerfile
Last active December 31, 2015 22:52
Node Dockerfile
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get install -y git git-core nodejs npm memcached mongodb
@a-r-d
a-r-d / exceptions.java
Last active August 29, 2015 14:24
How exceptions work in Java
// Call some method that may throw an exception!
private void derp() throws Exception {
somethingDangerous();
}
private void derpCaller() {
try {
derp();
} catch (Exception e) {
@a-r-d
a-r-d / producthack.js
Last active August 29, 2015 14:11
Some hacky squarespace stuff to future reference
// http://answers.squarespace.com/questions/17107/how-can-i-have-the-image-change-with-the-variant-on-my-product-pages
jQuery(document).ready(function(){
var variantList = [];
// secret data stored in variants
jQuery('.product-variants').hide();
jQuery.each($('.product-variants'), function(i){
var variant = this;
console.log("Variant:");
@a-r-d
a-r-d / deploy-roots.sh
Last active August 29, 2015 14:07
Bash script for deploying roots themes. Packages theme file into a zip, omits .git and node_modules.
#!/bin/bash
#
# This is a simple deploy script to create a .zip file of your theme
# The first argument passed becomes the .zip filename.
echo "Building site for packaging..."
grunt build
echo "Begin zipping..."
FILE="roots-deploy-theme.zip"
if [ ! -z "$1" ]
then
@a-r-d
a-r-d / swap.html
Last active August 29, 2015 14:07
Simple Image Swap
<div>
<a href=''>
<img class="image-swap-hover"
data-hover="http://i.imgur.com/EHQCuwT.png"
src="http://i.imgur.com/6xd21Qy.png"
width="500"
alt="Pikachu" />
</a>
</div>
<script>