This file contains hidden or 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
var cosineSimilarity = (A, B)=> { | |
let dotProduct = (a, b)=> { | |
if(a.length!=b.length) throw Error("Bad vector"); | |
let sum = 0; | |
for(let i = 0; i<a.length; i++) { | |
sum+=(a[i]*b[i]); | |
} | |
return sum; | |
}; | |
let magnitude = (a)=> { |
This file contains hidden or 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
const fse = require('fs-extra'); | |
const path = require('path'); | |
const sass = require('node-sass'); | |
function toCSS(scssFileName) { | |
return scssFileName.replace(".scss", ".css"); | |
} | |
module.exports = (async (scssFolder, outFolder)=> { | |
await fse.ensureDir(outFolder); |
This file contains hidden or 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
const fse = require('fs-extra'); | |
const path = require('path'); | |
const less = require('less'); | |
function toCSS(lessFileName) { | |
return lessFileName.replace(".less", ".css"); | |
} | |
module.exports = (async (lessFolder, outFolder)=> { | |
await fse.ensureDir(outFolder); |
This file contains hidden or 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
class Stack: | |
def __init__(self): | |
self.items = [] | |
def isEmpty(self): | |
return self.items == [] | |
def push(self, item): | |
self.items.append(item) |
This file contains hidden or 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
var on = function(name, handler) { | |
if(this._events.hasOwnProperty(name)) { | |
this._events[name].push(handler); | |
} | |
else { | |
this._events[name] = [handler]; | |
} | |
}; | |
var invoke = function(name, args) { | |
var res = []; |
This file contains hidden or 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
class Donor: | |
donors = [] | |
def Input(self, Name, DateOfBirth, Address, Phone, BloodGroup): | |
self.__Name = Name | |
self.__DateOfBirth = DateOfBirth | |
self.__Address = Address | |
self.__Phone = Phone | |
self.__BloodGroup = BloodGroup | |
@staticmethod | |
def Append(donor): |
This file contains hidden or 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
def multiply(m1, m2): | |
x1 = len(m1[0]) | |
y1 = len(m1) | |
x2 = len(m2[0]) | |
y2 = len(m2) | |
if(x1!=y2): | |
return("Error. Bad Matrix") | |
x3 = x2 |
This file contains hidden or 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
class ITEMINFO: | |
def __init__(self, ICode, Item, Price, Qty, Discount): | |
self.ICode = ICode | |
self.Item = Item | |
self.Price = Price | |
self.Qty = Qty | |
self.Discount = Discount | |
# self.Netprice = | |
def FindDisc(self): | |
pass; |
This file contains hidden or 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
print sorted(input("Enter your Strings: "), key=lambda string: len(string)) |
This file contains hidden or 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
#!/usr/bin/python | |
# Python 2.7.6 | |
# Authors: [thel3l, lunaroyster] | |
def binarySearch(sortedList, item, start=None, end=None): | |
#This happens when the item is not present in the array | |
if(start>end): | |
return(False) | |
#If start and end aren't defined, assume it's the entire array |