Skip to content

Instantly share code, notes, and snippets.

View jinweijie's full-sized avatar
🎾

Weijie JIN jinweijie

🎾
View GitHub Profile
@jinweijie
jinweijie / gist:4368710
Created December 24, 2012 10:09
CSS Vertical Align
<div style="display:table-cell; vertical-align:middle"> ... </div>
@jinweijie
jinweijie / gist:5002787
Created February 21, 2013 06:50
Skip certificate check
static void Main(string[] args)
{
ServicePointManager.ServerCertificateValidationCallback +=
new RemoteCertificateValidationCallback(ValidateCertificate);
Console.WriteLine("Client starting...");
ApplicationService svc = new ApplicationService();
App app = svc.GetAppInfo();
@jinweijie
jinweijie / gist:5268096
Created March 29, 2013 01:13
img to vhd installation
imagex /apply e:\sources\install.wim 1 f:\
@jinweijie
jinweijie / gist:6218706
Created August 13, 2013 07:32
Clear Workflow Table
delete [System.Activities.DurableInstancing].[InstancePromotedPropertiesTable]
delete [System.Activities.DurableInstancing].[KeysTable]
delete [System.Activities.DurableInstancing].[InstanceMetadataChangesTable]
delete [System.Activities.DurableInstancing].[RunnableInstancesTable]
delete [System.Activities.DurableInstancing].[InstancesTable]
@jinweijie
jinweijie / gist:6247885
Last active December 21, 2015 04:18
ASP.Net button confirm with validators
this.btnReject.OnClientClick = string.Format("if(!confirm('{0}')) return false;", Language.GetResource("AreYouSureToRejectTheForm", this.Page));
@jinweijie
jinweijie / gist:7544714
Created November 19, 2013 12:37
Email validation regex
^(?!\.)("([^"\r\\]|\\["\r\\])*"|([-a-z0-9!#$%&'*+/=?^_`{|}~] |(?@[a-z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$
@jinweijie
jinweijie / gist:7923887
Created December 12, 2013 06:14
Dynamic modify LoginUrl for FormsAuthentication
System.Configuration.Configuration configuration =
WebConfigurationManager.OpenWebConfiguration("/YourSite");
// Get the external Authentication section.
AuthenticationSection authenticationSection =
(AuthenticationSection)configuration.GetSection(
"system.web/authentication");
// Get the external Forms section .
FormsAuthenticationConfiguration formsAuthentication =
function isCardNumberValid(cardNumber, allowSpaces) {
if (allowSpaces) {
cardNumber = cardNumber.replace(/ /g, '');
}
if (!cardNumber.match(/^\d+$/)) {
return false;
}
var checksum = 0;
function createCORSRequest (poMethod, pcURL) {
var oXHR = new XMLHttpRequest();
if ('withCredentials' in oXHR) {
// Check if the XMLHttpRequest object has a "withCredentials" property.
// "withCredentials" only exists on XMLHTTPRequest2 objects.
oXHR.open(poMethod, pcURL, true);
} else if (typeof XDomainRequest != 'undefined') {
// Otherwise, check if XDomainRequest.
// XDomainRequest only exists in IE, and is IE's way of making CORS requests.
@jinweijie
jinweijie / Demo.cs
Created February 12, 2016 13:52 — forked from rowanmiller/Demo.cs
EF6.x | Correlating SQL to code
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.Infrastructure.Interception;
using System.Diagnostics;
using System.IO;
using System.Linq;
namespace Demo