Skip to content

Instantly share code, notes, and snippets.

View srideepprasad's full-sized avatar

Srideep Prasad srideepprasad

  • ThoughtWorks
  • Pune
View GitHub Profile
@srideepprasad
srideepprasad / primes.clj
Last active August 29, 2015 13:57
Simple Clojure Prime Sieve
(defn primes [m n]
(defn filter-non-primes
([numbers] (filter-non-primes numbers #{}))
([numbers current-prime-set]
(let
[next-prime (first numbers)]
(if (empty? numbers)
(filter #(> %1 m) current-prime-set)
(recur (doall(remove #(= (mod %1 next-prime) 0) numbers)) (conj current-prime-set next-prime))
))))
@srideepprasad
srideepprasad / ajaxhook.js
Created October 15, 2012 05:21
Ajax Hook.js - A simple Ajax Callback Interceptor
/*
AjaxHook.js - A simple utility library for intercepting Ajax calls.
This may be useful to inject simple interceptors to analyze pr capture Ajax traffic and may be even useful for automation tests to determine when an Ajax response returns.
To use :
1>Create a new AjaxHook object
var hook = new AjaxHook();
@srideepprasad
srideepprasad / FuzzyComparator.js
Created September 18, 2012 16:10
Fuzzy String Search based on a modified Dice Coeffecient alogorithm and conditional application of Levenstein Distance formula
function FuzzyComparator (keywords){
var adaptForComparison = function(str){
return str.replace(/\s+/,' ').toLowerCase();
}
var bigramize = function(keyword){