Skip to content

Instantly share code, notes, and snippets.


Tyler Rockwood rockwotj

View GitHub Profile
rockwotj / C# Combinatorics
Last active Aug 29, 2015
A couple of common combinatorics question solutions in C#
View C# Combinatorics
public static List<List<T>> GeneratePowerSet<T>(List<T> list)
var result = new List<List<T>>();
if (list.Count > 0)
foreach (var t in GeneratePowerSet(list.GetRange(1, list.Count - 1)))
var temp = DeepCopy(t);
rockwotj /
Last active Aug 29, 2015
Programming practice for interviews - Don't use an IDE!
  1. Take an absolute path and reduce it: /a/b/../foo.txt -> /a/foo.txt, /a/../b/./foo.txt -> /b/foo.txt

  2. You are given an array representing integer. Write a function which increments this integer. Example: input [1,2,3] -> output [1,2,4] which represents 123 + 1 = 124

  3. Given an unbalanced binary tree, write code to select a node at random (each node has an equal probability of being selected).

rockwotj / godist.rb
Created Dec 6, 2015
A short ruby script to cross platform a golang project
View godist.rb
#! /usr/bin/env ruby
if not ARGV[0] or ARGV[0] == "-h"
puts "Usage: ./go_dist <project>"
project_path = ARGV[0]
project = project_path.split('/')[-1]
puts "\e[1mStarting distribution of \e[32m'#{project}'\e[0m"
platforms = {
rockwotj / moviequote-rules.bolt
Last active Jan 9, 2016
Firebase bolt rules for the Moviequotes App
View moviequote-rules.bolt
path /quotes {
write() = true;
read() = true;
path /quotes/$moviequote is Moviequote;
type Moviequote {
movie: String,
quote: String
rockwotj / password-keeper-rules.bolt
Last active Jan 9, 2016
Firebase bolt rules for the Password Keeper App
View password-keeper-rules.bolt
path /users/$uid {
read() = isCurrentUser($uid);
write() = isCurrentUser($uid);
path /users/$uid/$password is Password;
type Password {
service: String,
password: String,
rockwotj / weatherpics-rules.bolt
Last active Jan 20, 2016
Firebase bolt rules for the Weatherpics With Auth App
View weatherpics-rules.bolt
type Weatherpic {
caption: String | Null,
imageUrl: String,
uid: UserID
type UserID extends String;
path /weatherpics {
read() { true }
#!/usr/bin/env python
import sys
import os
import argparse
from os import path
from os.path import isfile as exists
import signal
import json
import xml.etree.ElementTree as ET
rockwotj /
Last active Jun 28, 2017
An example in python on using the Stackdriver Monitoring API to query your Firebase Realtime Database's average load over the past day
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
rockwotj / Java TCP Server Wrapper
Last active Jun 29, 2017
This java class is a high level wrapper for the java ServerSocket class and is made to make string communication a lot easier.
View Java TCP Server Wrapper
View MyFunctions.scala
import scala.scalajs.js.annotation._
import scala.scalajs.js
import js.DynamicImplicits._
trait Request extends js.Any {
val body: js.Dictionary[Any] = js.native