Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
def findSmallestDivisor(s,t): | |
if(check_if_divisible(s, t)): | |
return len(find_shortest_repeating_substring(t)) | |
else: | |
return -1 | |
def check_if_divisible(s, t): | |
is_length_divisible = (len(s) % len(t)) == 0 | |
if(is_length_divisible): | |
return t*(len(s)//len(t)) == s |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
// Original from: http://killzonekid.com/worlds-smallest-fastest-xml-to-json-javascript-converter/ | |
// Thanks to Loamhoof for helping get this working! | |
// http://stackoverflow.com/questions/15675352/regex-convert-xml-to-json/15680000 | |
//Load XML into XML variable | |
var regex = /(<\w+[^<]*?)\s+([\w-]+)="([^"]+)">/; | |
while (xml.match(regex)) xml = xml.replace(regex, '<$2>$3</$2>$1>'); | |
xml = xml.replace(/\s/g, ' '). |