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
# | |
# score, provided for compatibility | |
# for speed one should really prepare the query once then reuse it | |
# | |
score = (string,query) -> | |
scorePrepared(string,prepare(query)) | |
# | |
# Match an item against a prepared query |
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 normalize(str) { | |
if (!str)return ""; | |
return str.toLowerCase().replace(/[^\u0000-\u007E]/g, function (a) { | |
return diacriticsMap[a] || a; | |
}); | |
} | |
function getDiacriticsMap() { | |
// replace most common accents in french-spanish by their base letter | |
//"ãàáäâæ?èéëêìíïîõòóöôœùúüûñç" |
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
// For use whithin node.js | |
referenceStack = null; | |
wrapperCache = null; | |
privilegiedCallback = null; | |
lastPrepareStackTrace = null; | |
// | |
// Each wrapper contain a link to their own callback |
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
{ | |
"name": "minimap", | |
"repository": { | |
"type": "git", | |
"url": "https:\/\/github.com\/atom-minimap\/minimap" | |
}, | |
"downloads": 971268, | |
"stargazers_count": 2109, | |
"releases": { | |
"latest": "4.16.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
/** | |
* @file | |
* CRC function implementations | |
*/ | |
#include "ga-crc.h" | |
/** | |
* CRC5-CCITT table | |
* Generate with the commands: |
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
private ulong CalculateCRCdirect(byte[] data, int length) | |
{ | |
// Initialize all variables for seeding and builing based upon the given coding type | |
// at first, compute constant bit masks for whole CRC and CRC high bit | |
crcmask = ((((ulong)1 << (order - 1)) - 1) << 1) | 1; //ORDER = 5 | |
crchighbit = (ulong)1 << (order - 1); | |
poly = 0x09 // CRC5 EPC |
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 HttpUploadFile<T>(string url, string fileName, byte[] fileBytes, string fileContentType = null, string fileFieldName = "file", Dictionary<string, string> extraFields = null) | |
where T : class | |
{ | |
var client = new HttpClient(); | |
var request = new HttpRequestMessage(HttpMethod.Post, new Uri(url)); | |
var boundary = "Upload----" + DateTime.UtcNow.Ticks.ToString("x"); | |
var multiPartContent = new MultipartFormDataContent(boundary); |
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
/* | |
* This work (Modern Encryption of a String C#, by James Tuley), | |
* identified by James Tuley, is free of known copyright restrictions. | |
* https://gist.github.com/4336842 | |
* http://creativecommons.org/publicdomain/mark/1.0/ | |
*/ | |
using System; | |
using System.IO; | |
using System.Text; |
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 class SendGridDeliveryServices | |
{ | |
private static string _sendGridApiKey = "..."; | |
public static bool SendMailToCustomerServices(string name, string email, string subject, string body) | |
{ | |
var from = new EmailAddress("system@xyz.com", name); | |
var reply = new EmailAddress(email, name); |
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
// | |
// Select the n-th item with probability `1/n`. | |
// Return an 0 based index (`i = n-1`) | |
// | |
// If parameter `a` is given, we select from probability `1/(n^a)` | |
// In particular, if a negative value of `a` is given, we select with probability `n^y, y = -a`; | |
// | |
// The code use the inverse of the cumulative probability function, to map the uniform distribution to the power distribution. | |
// | |
// Caveat: |
OlderNewer