Skip to content

Instantly share code, notes, and snippets.

View hafei's full-sized avatar
:octocat:
Working from home

hafei hafei

:octocat:
Working from home
View GitHub Profile
@markrendle
markrendle / CorsModule.cs
Last active May 28, 2017 07:38
Very basic CORS HttpModule
using System;
using System.Web;
namespace MyOtherSite
{
public class CorsModule : IHttpModule
{
public void Init(HttpApplication application)
{
application.BeginRequest += ApplicationOnBeginRequest;
@stuartbain
stuartbain / check_digit.rb
Last active May 21, 2019 09:25
Calculate check digits for SEDOL, CUSIP, ISIN and BBGID (Bloomberg Global Id) codes
module CheckDigit
class SEDOL
SEDOL_WEIGHTS = [1,3,1,7,3,9]
SEDOL_PATTERN = /[B-Db-dF-Hf-hJ-Nj-nP-Tp-tV-Xv-xYyZz\d]{6}/ # http://regexlib.com/REDetails.aspx?regexp_id=1044
def self.calculate(sedol)
raise 'Invalid pattern' unless sedol =~ SEDOL_PATTERN
// 方法一:string
function multiChar(str) {
if (typeof str !== 'string') {
return '';
}
var obj = {},
num = 0,
value = '',
ch = '';
@vnsam
vnsam / gist:187be13c408b291f9b9c0a28c72fb7ff
Created October 10, 2017 13:21
Pro version key for Beyond Compare - v4.2.3.22587
This can be used in Mac by using following trick:
Open trial.key at path: /Applications/Beyond\ Compare.app/Contents/Resources/trial.key
Replace content of trial.key with:
--- BEGIN LICENSE KEY ---
H1bJTd2SauPv5Garuaq0Ig43uqq5NJOEw94wxdZTpU-pFB9GmyPk677gJ
vC1Ro6sbAvKR4pVwtxdCfuoZDb6hJ5bVQKqlfihJfSYZt-xVrVU27+0Ja
hFbqTmYskatMTgPyjvv99CF2Te8ec+Ys2SPxyZAF0YwOCNOWmsyqN5y9t
q2Kw2pjoiDs5gIH-uw5U49JzOB6otS7kThBJE-H9A76u4uUvR8DKb+VcB
rWu5qSJGEnbsXNfJdq5L2D8QgRdV-sXHp2A-7j1X2n4WIISvU1V9koIyS