This file contains hidden or 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
export SVN_EDITOR=vim | |
svn propedit svn:ignore . | |
svn status --no-ignore |
This file contains hidden or 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://codebetter.com/gregyoung/2007/06/18/async-sockets-and-buffer-management/ | |
namespace TickerPlant | |
{ | |
/// <summary> | |
/// A manager to handle buffers for the socket connections | |
/// </summary> | |
/// <remarks> | |
/// When used in an async call a buffer is pinned. Large numbers of pinned buffers | |
/// cause problem with the GC (in particular it causes heap fragmentation). |
This file contains hidden or 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 guid = function () { | |
function S4() { | |
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); | |
} | |
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4()); | |
}; |
This file contains hidden or 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
if(!isCooperLogin())//cooper是否通过登录验证 | |
if(!isArkLogin())//arkclient是否通过登录验证 | |
redirectToArklogin();//跳转到ark登录页面 | |
else | |
setCooperLogin();//若ark通过验证则设置cooper通过验证写cookie | |
else | |
//... |
This file contains hidden or 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
// The code below would print overlapped A and B sequences like: | |
// ... | |
// A | |
// A | |
// B | |
// B | |
// ... | |
// | |
// Please add multi-threading protection code to make sure that | |
// As and Bs are printed in the order of: |
This file contains hidden or 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
CompositeId() | |
.KeyProperty(m => m.ID) | |
.KeyProperty(Reveal.Member<Method>("ServiceName")); |
This file contains hidden or 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
<startup> | |
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> | |
</startup> |
This file contains hidden or 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 (var md5 = new MD5CryptoServiceProvider()) | |
{ | |
var retVal = md5.ComputeHash(file); | |
var sb = new StringBuilder(); | |
for (int i = 0; i < retVal.Length; i++) | |
sb.Append(retVal[i].ToString("x2")); | |
return Json(sb.ToString()); | |
} |
This file contains hidden or 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
Regex isMobileRegex = new Regex( | |
@"(iemobile|iphone|ipod|android|nokia|sonyericsson|blackberry|samsung|sec\-|windows ce|motorola|mot\-|up.b|midp\-)" | |
,RegexOptions.IgnoreCase | RegexOptions.Compiled); | |
bool isMobileDevice = !string.IsNullOrEmpty(Request.UserAgent) && isMobileRegex.IsMatch(Request.UserAgent); |
This file contains hidden or 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 bool IsXmlHttpRequest(this HttpRequestBase request) | |
{ | |
var header = request.Headers["X-Requested-With"]; | |
return !string.IsNullOrEmpty(header) && header.ToLower().IndexOf("xmlhttp") >= 0; | |
} |