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
class UriHelpers | |
parseUri: (url) -> | |
k = window.Common.UrlHelpers.UriParseModes | |
a || (a = window.document.createElement('a')) | |
#Let browser do the work | |
a.href = url | |
r = {} | |
r[k[i]] = a[k[i]] for i in [0..8] |
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
Write-Host "Remember to run in an x86 Powershell" | |
Import-Module WebAdministration | |
$start_dir = Get-Location | |
CD IIS:\ | |
New-Item AppPools\test.pool | |
Set-ItemProperty IIS:\AppPools\test.pool -name "enable32BitAppOnWin64" -Value "true" |
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
## .gitconfig | |
[alias] | |
dt = difftool | |
mt = mergetool | |
[diff] | |
tool = bc3 | |
[difftool] | |
prompt = false | |
[difftool "bc3"] |
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 |
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
$("#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
//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
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
/// 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
routes.MapRoute("Shortcuts", | |
"{whereToGo}", | |
new | |
{ | |
controller = "TheRouter", | |
action = "TryRoute" | |
}); | |