Skip to content

Instantly share code, notes, and snippets.

@cachoimechi
cachoimechi / sha1.js
Created August 8, 2012 19:01
Javascript sha1 from webtoolkit
/**
*
* Secure Hash Algorithm (SHA1)
* http://www.webtoolkit.info/
*
**/
function SHA1 (msg) {
function rotate_left(n,s) {
@cachoimechi
cachoimechi / fuzzy.js
Created September 24, 2012 20:38
Autocomplete Fuzzy Matching
// http://dustindiaz.com/autocomplete-fuzzy-matching
var people = ['Daniel', 'Dustin', 'David', 'Damarcus', 'Russ'];
function matchPeople(input) {
var reg = new RegExp(input.split('').join('\\w*').replace(/\W/, ""), 'i');
return people.filter(function(person) {
if (person.match(reg)) {
return person;
}