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
/* | |
faster bind by http://jsperf.com/bind-vs-emulate/9 | |
*/ | |
(function () { | |
var slice = Array.prototype.slice; | |
Function.prototype.bind2 = function (context) { | |
var f = this; | |
var curriedArgs = slice.call(arguments, 1); | |
if (curriedArgs.length) { |
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 () { | |
// IndexedDB | |
var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.OIndexedDB || window.msIndexedDB, | |
IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.OIDBTransaction || window.msIDBTransaction, | |
dbVersion = 1.0; | |
// Create/open database | |
var request = indexedDB.open("elephantFiles", dbVersion), | |
db, | |
createObjectStore = function (dataBase) { |
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
//http://jsperf.com/call-apply-bind-method | |
function targetCall(thisArg, func) { | |
return func.call(thisArg, 1, 2); | |
} | |
function targetApply(thisArg, func) { | |
return func.apply(thisArg, [1, 2]); | |
} |
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 SortableBindingList<T> : BindingList<T> | |
{ | |
private readonly Dictionary<Type, PropertyComparer<T>> comparers; | |
private bool isSorted; | |
private ListSortDirection listSortDirection; | |
private PropertyDescriptor propertyDescriptor; | |
public SortableBindingList() | |
: base(new List<T>()) | |
{ |
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 GenericSqlProvider | |
{ | |
private readonly string connectionString; | |
public GenericSqlProvider(string connectionString) | |
{ | |
this.connectionString = connectionString; | |
} | |
public IResult<ProcedureResult> ExecuteCall(string procedureName, IDictionary<string, object> input) |
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 sealed class Remote<T> where T : MarshalByRefObject | |
{ | |
private readonly AppDomain domain; | |
private readonly T remoteObject; | |
private Remote(AppDomain domain, T remoteObject) | |
{ | |
this.domain = domain; | |
this.remoteObject = remoteObject; | |
} |
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 T XmlDeserializeFromString<T>(string objectData) | |
{ | |
return (T)XmlDeserializeFromString(objectData, typeof(T)); | |
} | |
public static object XmlDeserializeFromString(string objectData, Type type) | |
{ | |
var serializer = new XmlSerializer(type); | |
object result; |
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
// http://jsperf.com/circle-buffer-vc-array | |
var CircleBuffer = function (size) { | |
this._size = size; // max count of data | |
this._list = []; | |
this._cursorIndex = 0; | |
this._startIndex = 0; | |
this.length = 0; // actual data length | |
}; | |
CircleBuffer.prototype = { |
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> | |
<html> | |
<head> | |
<title>abc abcd</title> | |
<script> | |
function ReplaceNode(textNode, eNode) { | |
textNode.parentNode.replaceChild(textNode, eNode); | |
} | |
function DecorateText(node, match, offset) { |
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.Net; | |
using System.Net.Sockets; | |
using System.Threading; | |
namespace Proxy | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
OlderNewer