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.IO; | |
/// <summary> | |
/// Mapping Path Extensions | |
/// </summary> | |
/// Gist Url: https://gist.github.com/KyleGobel/4b0f2b93014cae7bb52b | |
public static class PathUtilities | |
{ | |
private static string MapAbsolutePath(string relativePath, string appendPartialPathModifier) |
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 ExampleController | |
{ | |
public ILog Logger {get; set;} | |
public void AnyMethod(int param1, int param2) | |
{ | |
Logger.DebugFormat("Parameters are {0}, and {1}", param1, param2); | |
} | |
} |
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 HttpUtilExtensions | |
{ | |
public static Task<string> PostJsonToUrlAsync(this string url, object data, | |
Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, | |
Action<string> callback = null) | |
{ | |
return SendStringToUrlAsync(url, method: "POST", requestBody: data.ToJson(), contentType: MimeTypes.Json, accept: MimeTypes.Json, | |
requestFilter: requestFilter, responseFilter: responseFilter, callback: callback); | |
} |
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
namespace Hipchat.Models | |
{ | |
public class HipchatMessage | |
{ | |
public int RoomId { get; set; } | |
public string RoomName { get; set; } | |
public string MessageSent { get; set; } | |
public string MentionName { get; set; } | |
public DateTime DateSent { get; set; } | |
public string FileUrl { get; set; } |
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 Xunit; | |
public class MyTests | |
{ | |
[Fact] //This means this is a test | |
public void TestMyGetMethodWorks() | |
{ | |
var journalService = new JournalService(/* not sure what kinda constructor you have */); |
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
/// <summary> | |
/// Class that provides the Watermark attached property | |
/// </summary> | |
public static class WatermarkService | |
{ | |
/// <summary> | |
/// Watermark Attached Dependency Property | |
/// </summary> | |
public static readonly DependencyProperty WatermarkProperty = DependencyProperty.RegisterAttached( | |
"Watermark", |
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 self = this; | |
var uglyVm = { | |
object1 : ko.observable("hello there"), | |
object2 : ko.observable(new (function () { | |
var self = this; | |
self.subObject1 = ko.observable("goodbye now"); | |
})(self)) | |
}; |
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
private IObservable<List<Client>> GetClients() | |
{ | |
var request = new RestRequest("client/", Method.GET); | |
var subject = new AsyncSubject<List<Client>>(); | |
_restClient.ExecuteAsync<ClientResponseDTO>(request, response => | |
{ | |
subject.OnNext(response.Data.Entities); | |
subject.OnCompleted(); | |
}); |
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 Foo { | |
public int Value { get; set; } | |
} | |
class Bar { | |
public int Value { get; set; } | |
} | |
static class Program { | |
static void Main() { | |
Expression<Func<Foo, bool>> predicate = | |
x => x.Value % 2 == 0; |
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($) { | |
$.fn.nodoubletapzoom = function() { | |
$(this).bind('touchstart', function preventZoom(e) { | |
var t2 = e.timeStamp | |
, t1 = $(this).data('lastTouch') || t2 | |
, dt = t2 - t1 | |
, fingers = e.originalEvent.touches.length; | |
$(this).data('lastTouch', t2); | |
if (!dt || dt > 500 || fingers > 1) return; // not double-tap |