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
config.Routes.MapHttpRoute( | |
name: "CatchAll", | |
routeTemplate: "{*.}", | |
defaults: new { controller = "Default" } | |
); | |
public class DefaultController : ApiController | |
{ | |
[HttpGet] | |
public HttpResponseMessage Get() |
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
<rewrite> | |
<rules> | |
<rule name="Mobile Rewrite" patternSyntax="ECMAScript" stopProcessing="true"> | |
<match url=".*" ignoreCase="true" negate="false" /> | |
<conditions logicalGrouping="MatchAny" trackAllCaptures="false"> | |
<add input="{HTTP_USER_AGENT}" pattern="midp|mobile|phone" /> | |
<add input="{HTTP_X-Device-User-Agent}" pattern="midp|mobile|phone" /> | |
<add input="{HTTP_X-OperaMini-Phone-UA}" pattern="midp|mobile|phone" /> | |
</conditions> | |
<action type="Redirect" url="http://localhost/mobile" appendQueryString="false" redirectType="Found" /> |
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 () { | |
var Slide = function (thumbs, image) { | |
this.thumbs = thumbs || []; | |
this.image = image || new Image(); | |
this.images = []; | |
if (this.thumbs.length) { | |
this.show(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
var autoPlacement = function (tip, element) { | |
var $document = $(document); | |
var offset = $(element).offset(); | |
var height = $document.outerHeight(); | |
var width = $document.outerWidth(); | |
var vert = 0.5 * height - offset.top; | |
var horiz = 0.5 * width - offset.left; | |
if (Math.abs(horiz) > Math.abs(vert)) { | |
return horiz > 0 ? 'right' : 'left'; | |
} |
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 static Exception Create<T>(string message, T exception) | |
where T : Exception | |
{ | |
Type exceptionType = typeof(T); | |
if (typeof(Exception).IsAssignableFrom(exceptionType)) | |
return new Exception(message, exception); | |
MethodInfo method = _createDel.Method.GetGenericMethodDefinition().MakeGenericMethod(exceptionType); | |
return method.Invoke(null, new object[] { message, exception }) as Exception; |
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 TimeBlock : IDisposable | |
{ | |
public TimeBlock(Action<int> handler = null, bool start = true) | |
{ | |
_handler = handler; | |
_watch = new Stopwatch(); | |
if (start) | |
Start(); | |
} |
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 load = function (img) { | |
var src = img.getAttribute('data-src'); | |
if (src && img.src !== src) { | |
img.src = src; | |
} | |
}; | |
var find = function () { | |
return document.querySelectorAll('.js-defer'); | |
}; |
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
extend = function (members) { | |
var that = this; | |
var extended; | |
if (members && members.constructor) { | |
extended = members.constructor; | |
} else { | |
extended = function () { | |
return parent.apply(this, arguments); | |
}; | |
} |
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 (Quill) { | |
var Element = function (tagName, attributes) { | |
var element = document.createElement(tagName); | |
if (attributes) { | |
for (var key in attributes) { | |
if (attributes.hasOwnProperty(key)) { | |
element.setAttribute(key, attributes[key]); | |
} | |
} |
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> | |
/// Gets the loaded types for this Assembly and skips if any types cannot be loaded when ReflectionTypeLoadException is thrown. | |
/// </summary> | |
/// <param name="assembly"></param> | |
/// <returns></returns> | |
public static Type[] GetLoadedTypes(this Assembly assembly) | |
{ | |
try | |
{ | |
return assembly.GetTypes(); |