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
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Data; | |
using System.Windows.Documents; | |
using System.Windows.Input; | |
using System.Windows.Media; | |
using System.Windows.Media.Imaging; |
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 Select-Folder($message='Select a folder', $path = 0) { | |
$object = New-Object -comObject Shell.Application | |
$folder = $object.BrowseForFolder(0, $message, 0, $path) | |
if ($folder -ne $null) { | |
$folder.self.Path | |
} | |
} | |
function Add-Zip |
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
//I saw this and thought there was a simple way around subbing extension methods | |
//http://blogs.clariusconsulting.net/kzu/how-to-mock-extension-methods/ | |
//My choice of solution was to just refactor the IRepo interface | |
namespace NSubIssueTests | |
{ | |
[TestFixture] | |
public class ExtensionOnInterfaceTests | |
{ |
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
routes.MapRoute("Shortcuts", | |
"{whereToGo}", | |
new | |
{ | |
controller = "TheRouter", | |
action = "TryRoute" | |
}); | |
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
/// more info: http://blog.nick.josevski.com/2012/01/05/unit-testing-javascript-methods-that-contain-jquery-ajax-calls | |
test("check if methodUnderTest completes successfully (mockJax way)", function () { | |
// Arrange | |
var jsonText = '{"id": "123","fieldName": "mj-fbs", "data": "fbs-text"}', | |
fieldBeingSaved = $('<input name="mj-fbs" Text="fbs-text"></input>'), | |
busyImg = $('<img id="mj-fbs-loading" alt="should-get-replaced-by-success-method"></img>'); | |
$.mockjax({ |
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
void Main() | |
{ | |
//demonstrating linq to xml handing of namespaces, using the feedburner style on Scott Hanselman's blog. | |
var request = (System.Net.HttpWebRequest) System.Net.WebRequest.Create(@"http://feeds.feedburner.com/ScottHanselman"); | |
using (var response = request.GetResponse()) | |
{ | |
var xmlDoc = XDocument.Load(response.GetResponseStream()); | |
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
//just paste this code in LinqPad (having selected Language: C# Program) and try and fix it ;) | |
void Main() | |
{ | |
//demonstrating linq to xml handing of namespaces, using the feedburner style on Scott Hanselman's blog. | |
var request = (System.Net.HttpWebRequest) System.Net.WebRequest.Create(@"http://feeds.feedburner.com/ScottHanselman"); | |
//this works: | |
using (var response = request.GetResponse()) | |
{ |
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
$("#core").load(href, function () { | |
setupClicks(); | |
}); | |
function setupClicks() { | |
$("a").unbind("click", clickHandler); | |
$("a").on("click", clickHandler); | |
}; | |
/* --- vs --- */ |
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
window.MyView = Backbone.View.extend({ | |
initialize: -> | |
_.bindAll(this,'render') | |
this.template = window.JST["MyView"] | |
this.model.bind('change', this.render) | |
render: -> | |
$(this.el).html(this.template(this.model.toJSON())) | |
events: { |
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
Requirements: Hg, Hg-Git, Git Bash | |
#!/bin/sh | |
hg clone $2 $1 | |
cd $1 | |
hg bookmark -r default master | |
hg gexport | |
mv .hg/git .git | |
rm -rf .hg | |
git init |
OlderNewer