Skip to content

Instantly share code, notes, and snippets.

@b1ff
b1ff / gist:2702859
Created May 15, 2012 15:57
ui.multiselect
/*
* jQuery UI Multiselect
*
* Authors:
* Michael Aufreiter (quasipartikel.at)
* Yanick Rochon (yanick.rochon[at]gmail[dot]com)
*
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
$countableTextAreas.live('keypress change', (function () {
var previousText = '';
return function () {
var $this = $(this),
allowedChars = Number.parseLocale($this.attr('data-maxLength')),
currLength = $this.val().length,
$spanWithCounter = $this.next('span.symbolCounter').find('span');
if (previousText == '') {
previousText = $this.val().substring(0, allowedChars);
@b1ff
b1ff / date.js
Created December 5, 2012 11:48
date js
/**
* Version: 1.0 Alpha-1
* Build Date: 13-Nov-2007
* Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
* License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/.
* Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
*/
Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",
__patchItemsProperty: function (excludeIds) {
if (!ko.isObservable(excludeIds)) {
throw new Error('Expected exclude ids to be observable array');
};
var self = this,
oldItems = {}; // in this hash will be stored all files, key-> file.Id(), value -> file
self.__fillHashFromItems(oldItems, self.items());
self.__filterItems(excludeIds(), oldItems);
__patchItemsProperty: function(excludeIds) {
if (!ko.isObservable(excludeIds)) {
throw new Error('Expected exclude ids to be observable array');
};
var self = this;
self.__updateFilesVisiblity(excludeIds());
ko.computed(function() {
self.__updateFilesVisiblity(excludeIds());
});
// Internal recursive comparison function for `isEqual`.
var eq = function(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
if (a === b) return a !== 0 || 1 / a == 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (a == null || b == null) return a === b;
// Unwrap any wrapped objects.
if (a instanceof _) a = a._wrapped;
if (b instanceof _) b = b._wrapped;
@b1ff
b1ff / chosen.jquery
Created November 26, 2013 13:00
chosen
// Chosen, a Select Box Enhancer for jQuery and Prototype
// by Patrick Filler for Harvest, http://getharvest.com
//
// Version 1.0.0
// Full source at https://github.com/harvesthq/chosen
// Copyright (c) 2011 Harvest http://getharvest.com
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
// This file is generated by `grunt build`, do not edit it by hand.
(function() {
[TestFixture]
public class FormsAuthenticationFilterTests
{
private class TestController : ApiController
{
[AllowAnonymous]
public void PublicMethod()
{
}
public interface IFormsAuthWrapper
{
FormsAuthenticationTicket Decrypt(string value);
string GetAuthToken(string username, bool persist);
}
public class FormsAuthWrapper : IFormsAuthWrapper
{
private const int SessionTimeout = 300;
[AllowAnonymous]
public class AuthenticationController: ApiController
{
private readonly IFormsAuthWrapper _formsAuth;
public AuthenticationController(IFormsAuthWrapper formsAuth)
{
_formsAuth = formsAuth;
}