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 IPAddress GetIpAddress(System.ServiceModel.OperationContext context) | |
{ | |
var prop = context.IncomingMessageProperties; | |
if (context.IncomingMessageProperties.ContainsKey(System.ServiceModel.Channels.RemoteEndpointMessageProperty.Name)) | |
{ | |
var endpoint = prop[System.ServiceModel.Channels.RemoteEndpointMessageProperty.Name] | |
as System.ServiceModel.Channels.RemoteEndpointMessageProperty; | |
if (endpoint != null) | |
{ | |
return IPAddress.Parse(endpoint.Address); |
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 createTableWithCaption = function (id, caption, tableStyle) | |
{ | |
var sb = "<div class='sd-info'><table id='" + id + "' class='itfa_sectionbody' style='" + tableStyle + "'>"; | |
if (caption) sb += "<caption>" + caption + "</caption>"; | |
return sb; | |
} | |
var createTableFn = function (id, fieldNames, caption, tableStyle, tfoot) | |
{ |
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
[TestFixture] | |
public class AsyncServiceClientTests | |
{ | |
private const string ListeningOn = "http://localhost:82/"; | |
ExampleAppHostHttpListener appHost; | |
[TestFixtureSetUp] | |
public void OnTestFixtureSetUp() | |
{ |
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
/* Incomplete un-tested buffered implementation designed to accomodate 1 write thread and 1 read thread only | |
* Not implemented yet, but is expected to be pooled. | |
*/ | |
public class NonBlockingReadBufferedStream | |
: Stream, IEnumerable<Action<Action<object>, Action<Exception>>>, IDisposable | |
{ | |
private const int MtuAppSize = 1450; | |
private const int BufferAllocationSize = 32 * 1024; | |
internal int ResetClearsBufferOfMaxSize = 4 * 1024 * 1024; //4MB |
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.Linq; | |
using System.Text; | |
using ServiceStack; | |
using ServiceStack.Common; | |
using ServiceStack.Common.Extensions; | |
using ServiceStack.Common.Utils; | |
using ServiceStack.Redis; | |
using ServiceStack.Redis.Generic; |
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.Linq; | |
using System.Text; | |
using ServiceStack; | |
using ServiceStack.Common; | |
using ServiceStack.Common.Extensions; | |
using ServiceStack.Common.Utils; | |
using ServiceStack.Redis; | |
using ServiceStack.Redis.Generic; |
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
#!/bin/bash | |
## DOWNLOADS | |
sudo curl -OL h ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.gz > /usr/local/src/pcre-8.12.tar.gz | |
sudo curl -OL h http://nginx.org/download/nginx-0.9.5.tar.gz > /usr/local/src/nginx-0.9.5.tar.gz | |
## Install PCRE | |
sudo mkdir -p /usr/local/src | |
cd /usr/local/src | |
tar xvzf pcre-8.12.tar.gz |
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 hasScriptEngine = 'ScriptEngine' in window; | |
var HAS_JSCRIPT = hasScriptEngine && window['ScriptEngine']() == 'JScript'; | |
var IS_IE = HAS_JSCRIPT; | |
var StringBuffer = function(opt_a1, var_args) { | |
this.buffer_ = HAS_JSCRIPT ? [] : ''; | |
if (opt_a1 != null) { | |
this.append.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
/* | |
* Faster jQuery DOM traversal for <= IE7. | |
* Usage: | |
* $Q() is a drop-in replacement for $(). Returns same jQuery object. | |
* | |
* //$Q = $; //Un-comment, to switch to use jQuery for benchmark comparisons | |
* My avg benchmarks in IE7 for traversing a 20x30 table was: | |
* 786ms vs 6140.67ms - Chrome can do it natively in 28ms | |
* | |
* Limitations: |
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 fromDtoDate = function(dateStr) { | |
if (!dateStr) return null; | |
return new Date(parseFloat(/Date\(([^)]+)\)/.exec(dateStr)[1])); | |
} | |
var formatDtoDate = function(dateObj) { | |
if (!dateObj) return ""; | |
if (dateObj != typeof "date") dateObj = fromDtoDate(dateObj); | |
var day = dateObj.getDate(), month = dateObj.getMonth() + 1; | |
if (day < 10) day = "0" + day; |
OlderNewer