Skip to content

Instantly share code, notes, and snippets.

View sharma-abhishek-it's full-sized avatar

Abhishek Sharma sharma-abhishek-it

View GitHub Profile
var fn1 = function(a,b){ console.log(a+b); }
var fn2 = (function(a,b){ console.log(a+b); })
-- This script takes 10s to run
maxm [] = error "No maximum for blank list"
maxm [x] = x
maxm (x:xs) = max x (maxm xs)
main = print (maxm [1..100000000])
-- This script takes 10s to run
@sharma-abhishek-it
sharma-abhishek-it / substr.coffee
Last active August 29, 2015 14:11
Shuffle search substr
String::linear_search = (from,to,sub) ->
i = from
j = 0
max = sub.length
while (to - i + 1) >= (max-j)
if @[i] == sub[j]
i++; j++
else
j = 0; i++
def change_price_to_corresponding_lac price
p_num = price.split(/[lacroe]+/)[0]
price.slice! p_num
p_string = price.strip
p_num.strip!
price = p_num.to_d
price = p_num.to_d * 100 if (p_string == 'cr' or p_string == 'crore' or p_string == 'c')
price
function l() {
}