Skip to content

Instantly share code, notes, and snippets.

View jbubriski's full-sized avatar

John Bubriski jbubriski

View GitHub Profile
@jbubriski
jbubriski / MassiveFluently.cs
Created January 6, 2012 18:35 — forked from codeimpossible/MassiveFluently.cs
Massive Fluently rough draft
using System;
using System.Dynamic;
using System.Linq;
using Massive;
using Massive.Expressions;
public class Test
{
public void TestMethod( )
{
@jbubriski
jbubriski / MassiveFluently.cs
Created January 6, 2012 18:45 — forked from codeimpossible/MassiveFluently.cs
Massive Fluently rough draft
using System;
using System.Dynamic;
using System.Linq;
using Massive;
using Massive.Expressions;
public class Test
{
public void TestMethod()
{
@jbubriski
jbubriski / C# T4 POCO Generator.tt
Created January 13, 2012 16:38
T4 POCO Generator
<#@ Include File="SaveOutput.tt" #>
<#@ Assembly Name="System.Xml" #>
<#@ Assembly Name="System.Text.RegularExpression" #>
<#@ Assembly Name="Microsoft.SqlServer.ConnectionInfo" #>
<#@ Assembly Name="Microsoft.SqlServer.Management.Sdk.Sfc" #>
<#@ Assembly Name="Microsoft.SqlServer.Smo" #>
<#@ Import Namespace="Microsoft.SqlServer.Management.Smo" #>
<#@ Import Namespace="System.Xml.Serialization" #>
<#@ Import Namespace="System.Collections" #>
<#@ Import Namespace="System.Collections.Generic" #>
@jbubriski
jbubriski / IServiceProvider.cs
Created March 13, 2012 19:36
A generic service provider to simplify Controller constructors and testing in ASP.NET MVC.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public interface IServiceProvider
{
T GetService<T>() where T : class;
}
@jbubriski
jbubriski / LinkChecker.xaml.cs
Created May 24, 2012 13:50
Find all links from a base URL, then check those against a new URL
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
@jbubriski
jbubriski / gist:3207278
Created July 30, 2012 14:22 — forked from codeimpossible/gist:3207268
Cache locking with timeout.
private static readonly string _languagesKey = "languages";
public static Dictionary<string, string> GetLanguages()
{
return GetData(_languagesKey, 15, () =>
{
// TODO: Get data from language service
var languages = new Dictionary<string, string>();
return languages;
@jbubriski
jbubriski / gist:3416172
Created August 21, 2012 14:44
jQuery buttons?
$(document).ready(function(){
var aInputs = $(":button");
for(var i=0;i<aInputs.length;i++){
var obj = $(aInputs[i]);
if(obj.hasClass("vhm_btn_xsmall") || obj.hasClass("vhm_btn_small") || obj.hasClass("vhm_btn_medium") || obj.hasClass("vhm_btn_large")){
obj.mousedown(function(){
var o = $(this);
var sClass = o.attr("class").toLowerCase();
o.removeClass(sClass);
o.addClass(sClass + "_on");
@jbubriski
jbubriski / gist:3516037
Created August 29, 2012 17:40
Ship Acceleration and Velocity
public float Acceleration { get; set; }
public void Update(GameTime gameTime)
{
var additionalVelocity = new Vector2((float)Mat.Cos(Rotation) * Acceleration, (float)Math.Sin(Rotation) * Acceleration);
var newVelocity = CurrentVelocity + additionalVelocity;
if (Math.Abs(newVelocity.DistanceTo(Vector2.Zero)) <= 250)
{
@jbubriski
jbubriski / update-ncache-ips.ps1
Created August 31, 2012 15:43
Update NCache config IP's
$clientConfigurationFile = 'C:\Program Files\NCache\config\client.ncconf'
$serverConfigurationFile = 'C:\Program Files\NCache\bin\service\Alachisoft.NCache.Service.exe.config'
$ips = ipconfig | Where-Object {$_ -match "IPv4 Address"} | foreach-object{$_.Split(":")[1].Trim()}
if ($ips -is [system.array])
{
$newIp = $ips[0].ToString()
}
else
@jbubriski
jbubriski / Enemy.cs
Created September 6, 2012 18:15
Radius-Based Hit Detection
public class Enemy : Sprite
{
public int HitRadius { get { return 10; } }
}