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
<!doctype> | |
<html> | |
<head></head> | |
<body> | |
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script> | |
<script> | |
$(document.body).prepend( |
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
<?xml version="1.0"?> | |
<configuration> | |
<appSettings> | |
<add key="ClientValidationEnabled" value="true"/> | |
<add key="UnobtrusiveJavaScriptEnabled" value="true"/> | |
</appSettings> | |
<system.web> | |
<compilation debug="true" targetFramework="4.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
javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3.2",function($,L){$('pre').css({%20'font'%20:%20'12px%20Monaco,"Courier%20New","DejaVu%20Sans%20Mono","Bitstream%20Vera%20Sans%20Mono",monospace'%20})}); |
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.ComponentModel.DataAnnotations; | |
using System.Text.RegularExpressions; | |
using System.Web.Mvc; | |
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] | |
public sealed class EmailAddressAttribute : DataTypeAttribute, IClientValidatable | |
{ | |
private static Regex _regex = new Regex(@"^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\ |
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.ComponentModel.DataAnnotations; | |
using System.Web.Mvc; | |
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] | |
public sealed class DateAttribute : DataTypeAttribute, IClientValidatable | |
{ | |
public DateAttribute() : base(DataType.DateTime) | |
{ |
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.ComponentModel; | |
public static class Parser { | |
public static T Parse<T>(this string value) { | |
// Get default value for type so if string | |
// is empty then we can return default value. | |
T result = default(T); | |
if (!string.IsNullOrEmpty(value)) { |
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 Things.IO.Mongo | |
{ | |
using System; | |
using MongoDB.Bson.Serialization; | |
using MongoDB.Driver; | |
using NUnit.Framework; | |
using Simple.Data; | |
using Simple.Data.MongoDb; | |
internal static class DatabaseHelper |
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 Slugifyer { | |
public static string Slugify(this string phrase) | |
{ | |
string str = phrase.RemoveAccent().ToLower(); | |
str = Regex.Replace(str, @"[^a-z0-9\s-]", ""); // invalid chars | |
str = Regex.Replace(str, @"\s+", " ").Trim(); // convert multiple spaces into one space | |
str = str.Substring(0, str.Length <= 45 ? str.Length : 45).Trim(); // cut and trim it | |
str = Regex.Replace(str, @"\s", "-"); // hyphens |
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 timeout; | |
$('.map-img').live('mouseover', function() { | |
var $this = $(this); | |
var $us = $this.parent().children(); | |
timeout = setInterval(function() { | |
if ($us.filter(':visible').length == 1) { | |
var last = $us.last(); | |
last.fadeIn(function(){ | |
last.siblings().show(); |
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 abstract class ApplicationController : Controller | |
{ | |
protected ActionResult RespondTo(Action<FormatCollection> format) { | |
return new FormatResult(format); | |
} | |
protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior) { | |
return new ServiceStackJsonResult { | |
Data = data, | |
ContentType = contentType, |
OlderNewer