//Usage $(element).contentslider({ direction: 'right', });
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 windowURL = window.URL || window.webkitURL; | |
ko.bindingHandlers.file = { | |
init: function (element, valueAccessor) { | |
$(element).change(function () { | |
var file = this.files[0]; | |
if (ko.isObservable(valueAccessor())) { | |
valueAccessor()(file); | |
} | |
}); |
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
////////////////////////////////////////////////////////// | |
// Checks whether a string contains a double byte character | |
// target = the string to be checked | |
// | |
// Return true if target contains a double byte char; false otherwise | |
////////////////////////////////////////////////////////// | |
function containsDoubleByte (target) { | |
var str = new String(target); | |
var oneByteMax = 0x007F; |
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
// Returns a function, that, as long as it continues to be invoked, will not | |
// be triggered. The function will be called after it stops being called for | |
// N milliseconds. If `immediate` is passed, trigger the function on the | |
// leading edge, instead of the trailing. | |
function debounce(func, wait, immediate) { | |
var timeout; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { | |
timeout = null; |
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 string GetClientIp(HttpRequestMessage request) | |
{ | |
if (request.Properties.ContainsKey("MS_HttpContext")) | |
{ | |
return ((HttpContextWrapper)request.Properties["MS_HttpContext"]).Request.UserHostAddress; | |
} | |
if (request.Properties.ContainsKey(RemoteEndpointMessageProperty.Name)) | |
{ | |
RemoteEndpointMessageProperty prop; |
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
[Route("api/dothis/{id}")] | |
[AcceptVerbs("POST")] | |
[Throttle(Name = "ApiThrottle", Message = "You must wait {n} seconds before accessing this url again.", Seconds = 5)] | |
[Authorize] | |
public HttpResponseMessage DoThis(int id) | |
{ | |
// do something | |
} | |
public class ThrottleAttribute : ActionFilterAttribute |
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
git log --pretty=oneline --since=1.day | |
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
-- select maximum user connections for an db instance | |
SELECT maximum FROM sys.configurations WHERE name='user connections' | |
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 MvcApplication.Tests.Controllers | |
{ | |
using System.Web.Mvc; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
using MvcApplication.Controllers; | |
[TestClass] | |
public class AdminControllerTest | |
{ | |
IUserService _userService; |
OlderNewer