Skip to content

Instantly share code, notes, and snippets.

@dkellycollins
dkellycollins / InputHelper.cs
Created January 17, 2013 18:08
A helper class that manages input for XNA games. I tried to make this optimized for any game.
#region File Description
//-----------------------------------------------------------------------------
// UserInput.cs
//
// Author: Devin Kelly-Collins
//
// Kansas State Univerisity CIS 580 Fall 2012 Dungeon Crawler Game
// Copyright (C) CIS 580 Fall 2012 Class. All rights reserved.
// Released under the Microsoft Permissive Licence
//-----------------------------------------------------------------------------
///<summary>
/// Contains functions to load text files as common collections.
///</summary>
public class IOHelper
{
#region Text IO
/// <summary>
/// Attempts to load in a dictionary from a basic text file.
/// </summary>
/// <typeparam name="TKey">The type of the key.</typeparam>
@dkellycollins
dkellycollins / QueueProcessor
Last active December 12, 2015 03:09
QueueProccessor for processing data. This class is meant to be inherited and have the sub class handle actually processing the data. Currently implemented with BackgroundWorker and is untested.
///<summary>
///Handles processing data of type T. Subclass implements process and handles storing results.
///</summary>
public abstract class QueueProcessor<T>
{
private Queue<T> _data;
private BackgroundWorker _worker;
private bool _stopOnEmpty;
public delegate ErrorHandler(Exception e);
@dkellycollins
dkellycollins / Create.cshtml
Last active August 24, 2016 21:44
A generic model controller for ASP.NET MVC framework.
@using BootstrapSupport
@model Object
<div class="container">
@using (Html.BeginForm())
{
@Html.ValidationSummary(true)
<fieldset class="form-horizontal">
<legend>@Model.GetLabel() <small>Details</small></legend>
@foreach (var property in Model.VisibleProperties())
using System;
namespace Sum
{
class Program
{
//Estimates the perimeter of a circle of radius 1 using Archimededes formulas
static void Main(string[] args)
{
int n = 96; //n-polygon to estimate with.
class Program
{
static void Main(string[] args)
{
int numOfCoPrimes = 0;
for (int i = 1; i < 1225; i++)
{
int g = gdc(i, 1225);
if (g == 1)
numOfCoPrimes++;
@dkellycollins
dkellycollins / ng-table.d.ts
Last active September 10, 2015 14:43
ng-table.d.ts
declare module ngTable {
class ngTableParams {
data:any[];
constructor(parameters:any, settings:any);
parameters(newParameters:string, parseParamsFromUrl:string):any;
settings(newSettings:string):any;
@dkellycollins
dkellycollins / BaseForm.cs
Last active March 8, 2018 20:49
Example of how you might use Ninject within a WinForms application.
/// <summary>
/// Non-Generic BaseForm. Provides functionality for retrieving the controller.
/// </summary>
public class BaseForm : Form
{
/// <summary>
/// Gets the controller for the given type.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
package com.dkellycollins.ioc;
import java.util.HashMap;
import java.util.Map;
/**
* Manages class instances.
*/
public abstract class Module {
/**
* Provides the ability to fetch global plugin objects.
*/
class PluginService {
static $inject = ['$ionicPlatform', '$window', '$q', '$log'];
constructor(private $ionicPlatform: ionic.platform.IonicPlatformService,
private $window: ng.IWindowService,
private $q: ng.IQService,
private $log: ng.ILogService) {