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
// Quickly switch to a different culture to perform work without | |
// switching the entire thread | |
// Usage: | |
// Console.WriteLine("Starts in English : {0}", DateTime.Now); | |
// | |
// Culture.As(Culture.Type.German, () => { | |
// Console.WriteLine("Now in German : {0}", DateTime.Now); | |
// }); | |
// |
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 MimeTypeLocator { | |
#region Available Types | |
private static Dictionary<string, string> _MimeTypes = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { | |
{ "323", "text/h323" }, | |
{ "acx", "application/internet-property-stream" }, | |
{ "ai", "application/postscript" }, | |
{ "aif", "audio/x-aiff" }, | |
{ "aifc", "audio/x-aiff" }, |
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
'requests a name and attaches to that process | |
Public Sub AttachToNamedProcess() | |
Dim process As String = InputBox("What process name", "Process Name", "w3wp.exe") | |
'make sure something was provided | |
If process Is Nothing Then process = "" | |
process = process.Trim() | |
If String.IsNullOrEmpty(process) Then Return | |
_AttachToProcess(process, False) | |
End Sub |
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
// Call CaseInsensitiveViewEngine.Register(...) from Global.asax | |
using System; | |
using System.Web; | |
using System.Web.Mvc; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Web.Routing; | |
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 HomeController : Controller { | |
public ActionResult Index() { | |
var view = new ViewFor.Index { Name = "Hugo" }; | |
return this.View(view); | |
} | |
public static class ViewFor { | |
public class Index { |
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 an anonymous type directly (even being passed in as a Dynamic) | |
//will result in an exception message. Using this converts the Anonymous | |
//type to a dynamic that can be used as expected | |
//this doesn't include any validation of properties but it can be done | |
@helper something_that_renders_lists(params dynamic[] links) { | |
links = Json.Decode(Json.Encode(links)); | |
<ul> | |
@foreach(var link in links) { |
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 script = document.createElement("script"); | |
script.src = "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"; | |
document.body.appendChild(script); | |
var start_typing = function(jquery, timeout) { | |
var input = jquery(".txtInput"); | |
var do_next_phrase = function() { | |
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
// | |
// wires up an object of selectors | |
// | |
// var ui = { | |
// menu: "#main-menu", | |
// list: "#list .item", | |
// options: { | |
// yes: "#option-yes", | |
// no: "#option-no" | |
// } |
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
module.exports = { | |
//resolves the root of the site | |
map_path: function(path) { | |
return path.replace(/^~/, global.process.env.PWD); | |
}, | |
//resolves the path and performs a require | |
require: function(path) { |
OlderNewer