Skip to content

Instantly share code, notes, and snippets.

View Experiment5X's full-sized avatar

Adam Spindler Experiment5X

View GitHub Profile
import scala.util.Random
import scala.io.StdIn
object BlackJack extends App {
case class InvalidCardValueException(value: Int) extends Exception(s"Invalid card value of $value")
sealed abstract class Suit
case object Spades extends Suit
case object Clubs extends Suit
@Experiment5X
Experiment5X / vscode.json
Created July 21, 2018 16:51
vscode vim settings
{
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["<C-j>"],
"after": ["j", "j", "j", "j"]
},
{
"before": ["<C-k>"],
"after": ["k", "k", "k", "k"]
},
@Experiment5X
Experiment5X / prototype_inheritance.js
Created February 11, 2018 23:41
Javascript prototypes
/**
* Class definition for Monster
*/
function Monster(name) {
this.health = 1000;
this.attack = 100;
this.name = name;
}
Monster.prototype.attack = function(other) {
@Experiment5X
Experiment5X / PyLoko.py
Created January 27, 2018 20:55
PyLoko - basic usage of FourLoko API
import json
import requests
def find_loko(street_address):
request_params = {
'action': 'fourLoko/findProduct',
'address': street_address
}
@Experiment5X
Experiment5X / FootballScores.swift
Created September 16, 2016 01:27
Generate a list of possible methods of scoring in football for a given score.
//
// main.swift
// FootballScores
//
// Created by Adam Spindler on 9/15/16.
// Copyright © 2016 Expetelek. All rights reserved.
//
import Foundation
@Experiment5X
Experiment5X / xboxavatar.rb
Created February 3, 2015 05:36
Gets a list of all the avatar items for a specified Xbox360 game. The program requires a title id for each game which is an 8-digit id that can be found in the URL of game's webpage on xbox.com
require 'rubygems'
require 'nokogiri'
require 'open-uri'
if ARGV.length != 1
puts "Usage: xboxavatar title-id"
exit
end
begin
@Experiment5X
Experiment5X / C++ProgramBug.md
Last active August 29, 2015 14:09
An interesting bug I found in one of my programs

Today I came across a bug in my project that originally had me thinking I was experiencing yet another bug in Qt Creator, but it turns out I was wrong. In my project I had three main files:

ClipboardSynchronizer.h
ClipboardSynchronizer.cpp
main.cpp

The buggy version of my code in main.cpp was this:

@Experiment5X
Experiment5X / GitCVSComments.py
Created October 21, 2014 02:10
Put CVS comments at the top of files in your git repo. I made this because my CS class at RIT requires you to use CVS for these comments, and I would much rather use git.
import sys
import os
import re
import subprocess
class CommitInfo:
date = ''
timestamp = ''
message = ''
@Experiment5X
Experiment5X / PyhtonStringMultiply.cpp
Last active August 29, 2015 14:01
Python-like string multiplication... probably not a good idea to actually use though.
#include <iostream>
#include <string>
std::string operator *(std::string str, int n)
{
std::string toReturn = "";
if (n <= 0)
return toReturn;
for (int i = 0; i < n; i++)
@Experiment5X
Experiment5X / RvalueReference.cpp
Created May 14, 2014 02:07
For future me, when I forget how this works.
#include <iostream>
#include <algorithm>
using namespace std;
class Matrix
{
public:
// constructor
Matrix(int width, int height) :