Skip to content

Instantly share code, notes, and snippets.

View Stephanvs's full-sized avatar
🏝️
Vacation mode

Stephan van Stekelenburg Stephanvs

🏝️
Vacation mode
View GitHub Profile
@Stephanvs
Stephanvs / custom_jquery_selector
Created July 26, 2011 08:58
Custom jQuery selector
$.expr[':'].internal = function (obj, index, meta, stack) {
var $this = $(obj);
var url = $this.attr('href') || '';
var isInternalLink;
// Check link
isInternalLink = url.substring(0, rootUrl.length) === rootUrl || (/[^\:]/).test(url);
// Ignore or Keep
return isInternalLink;
@Stephanvs
Stephanvs / item
Created November 28, 2011 20:58
Culture objects in REST API Hayman.
{
item: {
name: [ { value: "Bank", locale: "en-US" }, { value: "Bank", locale: "nl-NL" } ]
}
},
{
item: {
name: [ { value: "Couch", locale: "en-US" }, { value: "Bank", locale: "nl-NL" } ]
}
}
@Stephanvs
Stephanvs / DynamicJsonDeserializer.cs
Created February 22, 2012 18:54 — forked from rdingwall/DynamicJsonDeserializer.cs
RestSharp deserialize JSON to dynamic
// ReSharper disable CheckNamespace
namespace RestSharp.Deserializers
// ReSharper restore CheckNamespace
{
public class DynamicJsonDeserializer : IDeserializer
{
public string RootElement { get; set; }
public string Namespace { get; set; }
public string DateFormat { get; set; }
@Stephanvs
Stephanvs / UrlHelperExtensions.cs
Created February 23, 2012 20:46
Url Helper for ASP.NET MVC hosted on AppHarbor
public static string ToPublicUrl(this UrlHelper urlHelper, Uri relativeUri)
{
var httpContext = urlHelper.RequestContext.HttpContext;
var uriBuilder = new UriBuilder
{
Host = httpContext.Request.Url.Host,
Path = "/",
Port = 80,
Scheme = "http",
@Stephanvs
Stephanvs / JsonNetFormatter.cs
Created March 7, 2012 13:34
JSON.net Formatter for ASP.NET MVC WEB-API
using System;
using System.IO;
using System.Net;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Global.Serialization
private static void RegisterScripts(BundleCollection bundles)
{
bundles.Add(new Bundle("~/assets/scripts", new JsTransformer(new List { new TypeScriptTranslator() }))
.Include("~/Scripts/path/to/your.ts"));
}
@Stephanvs
Stephanvs / ObjectExtensions.cs
Created May 17, 2013 20:06
C# IsNull and IsNotNull Extension Methods
namespace System
{
public static class ObjectExtensions
{
public static bool IsNull(this object obj)
{
return obj == null;
}
public static bool IsNotNull(this object obj)
@Stephanvs
Stephanvs / gist:6155132
Created August 5, 2013 11:07
p4merge on Windows
[merge]
keepBackup = false;
tool = p4merge
[mergetool "p4merge"]
cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
keepTemporaries = false
trustExitCode = false
keepBackup = false
namespace BenjiiMe.Animation
{
public class ContinuumTransition : TransitionElement
{
public const string ContinuumElementPropertyName = "ContinuumElement";
public const string ContinuumModePropertyName = "Mode";
public FrameworkElement ContinuumElement
{
get { return (FrameworkElement)GetValue(ContinuumElementProperty); }