Skip to content

Instantly share code, notes, and snippets.

View geekf's full-sized avatar

Fakhruddin Ali Hussain geekf

View GitHub Profile
@geekf
geekf / kmpMatch.js
Created October 16, 2018 11:21
Sample implementation for KMP Match algorithm
function computeLpsArray(pat) {
let len = 0;
let i = 1;
const lps = [];
lps[0] = 0;
while (i < pat.length) {
if (pat.charAt(i) === pat.charAt(len)) {
len++;
lps[i] = len;
@geekf
geekf / NumberDeduction
Last active August 29, 2015 14:23
Deduce the numbers - Whatsapp Puzzle
/*
solve this....
(b)(r)(w)
+(b)(r)(w)
+(b)(r)(w)
----------
(w)(w)(w)
What numbers are (b),(r),(w)?
*/
@geekf
geekf / FBPokeBack
Last active August 29, 2015 14:07
Poke back auto-bot
/* Pokes back every 2 minutes. Run in console on https://www.facebook.com/pokes/ */
window.setInterval(function(){var x=document.evaluate('//*[translate(text(),"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")="poke back"]',document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE),i=0;for(;i<x.snapshotLength;i++)x.snapshotItem(i).click()},120000);