Skip to content

Instantly share code, notes, and snippets.

View wwahammy's full-sized avatar

Eric Schultz wwahammy

View GitHub Profile
@wwahammy
wwahammy / gist:1211457
Created September 12, 2011 14:52
Ever wanted to use List.Add with the Aggregate method easily? Here you go.
public static IList<T> LAdd<T>(this IList<T> list, T item)
{
list.Add(item);
return list;
}
@wwahammy
wwahammy / gist:2032015
Created March 13, 2012 21:55
Holy cow
/// <summary>
/// TODO: holy cow, is this confusing
/// </summary>
public Task<IEnumerable<string>> SystemFeeds
{
get
{
var tcs = new TaskCompletionSource<IEnumerable<string>>();
var list = new List<string>();
public class CoAppService : ICoAppService
{
internal readonly PackageManager Pm;
public CoAppService()
{
Pm = PackageManager.Instance;
}
public Task<Tuple<string, IEnumerable<string>>> GetPolicy(PolicyType type)
35:58.581 CoApp.Service(3524) «Information/CoApp Service»-Starting New Listener 14
35:59.614 CoApp.Service(3524) «Information/CoApp Service»-Starting new session...
35:59.614 CoApp.Service(3524) �Information/CoApp Service�-Request:[1]FindPackages?canonicalName=coapp:*[*]-0.0.0.0+-*-*&rqid=1&
35:59.861 CoApp.Service(3524) «Information/CoApp Service»-Ending Client: [4124]-[4124/0]
[7900] «managed-bootstrap/Warning»-Startup :"C:\Users\Eric\Documents\GitHub\testpackages\copkg\liba-1.0.0.0-x86.msi" "--uilevel=5" "--remove="
[7900] «managed-bootstrap/Information»-Found Valid file C:\Users\Eric\Documents\GitHub\testpackages\copkg\liba-1.0.0.0-x86.msi:
[7900] «managed-bootstrap/Information»-Found Valid file C:\Users\Eric\Documents\GitHub\testpackages\copkg\liba-1.0.0.0-x86.msi:
[7900] «managed-bootstrap/Information»-Got to Installer Stage Two
[3236] «Information/CoApp Service»-Starting New Listener 20
[3236] «Information/CoApp Service»-Starting new session...
[3236] «Information/CoApp Service»-Request:[1]AddFeed?location=C%3a%5cUsers%5cEric%5cDocuments%5cGitHub%5ctestpackages%5ccopkg&session=True&rqid=1&
[7900] «Information/CoApp.Toolkit»-Response:[1]FeedAdded?location=C:\Users\Eric\Documents\GitHub\testpackages\copkg&rqid=1&
[3236] «Information/CoApp Service»-Ending Client: [7744]-[7744/0]
[7900] «Information/CoApp.Toolkit»-Response:[1]TaskComplete?rqid=1&
@wwahammy
wwahammy / gist:5008687
Created February 21, 2013 22:01
A ToDictionary method that should have already been in LINQ
//usage: filteredDictionary = someDictionary.Where(kv => kv.Key != "KeyToFilterOut").ToDictionary();
public static Dictionary<T1, T2> ToDictionary<T1, T2>(this IEnumerable<KeyValuePair<T1, T2>> input) {
return input.ToDictionary(kv => kv.Key, kv => kv.Value);
}
@wwahammy
wwahammy / gist:6244049
Created August 15, 2013 19:36
Can I have this in one line?
_mockExtService.Verify(m => m.CreateAutoRegisteredUser(EMAIL, FIRSTNAME, LASTNAME), Times.Once());
_mockExtService.Verify(m => m.CreateAutoRegisteredUser(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), Times.Once());
@wwahammy
wwahammy / My C# annoyance of the day
Created August 20, 2013 17:41
My C# annoyance of the day
public void SomeMethod(){
if (SomeCondition())
{
string name = "something";
//use name here
}
string name = "something else" //COMPILER ERROR: name is already declared in this scope... BUT it's not!!!
}
var ourQueries = Repository.Commits.QueryBy(new CommitFilter
{
Since = Repository.Refs
});
var queries = ourQueries.Where(i => i.Committer.When >= since).OrderByDescending(i => i.Committer.When)

Keybase proof

I hereby claim:

  • I am ericschultz on github.
  • I am wwahammy (https://keybase.io/wwahammy) on keybase.
  • I have a public key whose fingerprint is 277B F179 10B6 38E5 A3E0 7E36 E1F8 EEF4 5EC9 E5BF

To claim this, I am signing this object: