This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Add-SolutionFolder { | |
param( | |
[string]$Name | |
) | |
$solution2 = Get-Interface $dte.Solution ([EnvDTE80.Solution2]) | |
$solution2.AddSolutionFolder($Name) | |
} | |
function Get-SolutionFolder { | |
param ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function global:Get-Types { | |
param ( | |
$ProjectName, | |
$BaseType, | |
[switch]$IgnoreProjectReferences | |
) | |
if($ProjectName) { | |
$project = Get-Project $ProjectName | |
} | |
else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var factory = new PackageRepositoryFactory(); | |
IPackageRepository repository = factory.CreateRepository("https://go.microsoft.com/fwlink/?LinkID=206669"); | |
foreach (var p in repository.GetPackages()) { | |
Console.WriteLine(p); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Print all project items | |
Recurse-Project -Action {param($item) "`"$($item.ProjectItem.Name)`" is a $($item.Type)" } | |
# Function to format all documents based on https://gist.github.com/984353 | |
function Format-Document { | |
param( | |
[parameter(ValueFromPipelineByPropertyName = $true)] | |
[string[]]$ProjectName | |
) | |
Process { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Voting : Hub { | |
public void SubmitVote(int answerId) { | |
question.Answers.Single(x => x.AnswerId == answerId).NumVotes++; | |
Clients.update(question); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Voting : Hub { | |
// Could load this from a DB | |
static Question question = new Question { | |
QuestionText = "What's your favourite upcoming technology?", | |
Answers = new List<Answer> { | |
new Answer { AnswerId = 1, AnswerText = "C# 5" }, | |
new Answer { AnswerId = 2, AnswerText = "WebSockets" }, | |
new Answer { AnswerId = 3, AnswerText = "Windows 8" }, | |
new Answer { AnswerId = 5, AnswerText = "Magic rainbow unicorns" }, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class FuncExtensions { | |
public static Func<TKey, TResult> Memoize<TKey, TResult>(this Func<TKey, TResult> f) { | |
return f.Memoize(EqualityComparer<TKey>.Default); | |
} | |
public static Func<TKey, TResult> Memoize<TKey, TResult>(this Func<TKey, TResult> f, IEqualityComparer<TKey> equalityComparer) { | |
var cache = new ConcurrentDictionary<TKey, Lazy<TResult>>(equalityComparer); | |
return key => { | |
var lazy = cache.GetOrAdd(key, new Lazy<TResult>(() => f(key))); | |
return lazy.Value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git -s status | |
Unknown option: -s | |
usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] | |
[-p|--paginate|--no-pager] [--no-replace-objects] | |
[--bare] [--git-dir=<path>] [--work-tree=<path>] | |
[-c name=value] [--help] | |
<command> [<args>] | |
$ git status -s | |
?? .gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class QueryExtensions { | |
public static IQueryable<T> SortBy<T>(this IQueryable<T> source, string propertyName) { | |
if (source == null) { | |
throw new ArgumentNullException("source"); | |
} | |
// DataSource control passes the sort parameter with a direction | |
// if the direction is descending | |
int descIndex = propertyName.IndexOf(" DESC"); | |
if (descIndex >= 0) { | |
propertyName = propertyName.Substring(0, descIndex).Trim(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="jquery-1.6.2.js" /> | |
(function (window) { | |
"use strict"; | |
if (typeof (window.signalR) !== "function") { | |
throw "SignalR: SignalR is not loaded. Please ensure SignalR.js is referenced before ~/signalr/hubs."; | |
} | |
var viewModels = {}; | |
var oldProcessState = window.signalR.hub.processState; |
OlderNewer