Skip to content

Instantly share code, notes, and snippets.

View danieltanfh95's full-sized avatar

Daniel danieltanfh95

View GitHub Profile
@danieltanfh95
danieltanfh95 / findSmallestDivisor.py
Created December 18, 2019 15:09
findSmallestDivisor
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
@danieltanfh95
danieltanfh95 / buttons.py
Created December 18, 2019 14:46
Buttons py
def check_if_button_touched(point_x, point_y, button_x_min, button_y_min, button_x_max, button_y_max):
within_x = button_x_min <= point_x <= button_x_max
within_y = button_y_min <= point_y <= button_y_max
return within_x and within_y
def get_mid_point(button_x_min, button_y_min, button_x_max, button_y_max):
return (button_x_min+button_x_max) / 2.0, (button_y_min+button_y_max) / 2.0

Shadowverse Card API

Basic

Every response to all the endpoints is encapsulated in a root JSON object with two keys, a data_headers and a data. The data value is a JSON object. For every endpoint, there exist different keys which contain the actual queried data. In case of any errors, data will contain an empty JSON array.

Card information

@danieltanfh95
danieltanfh95 / dl.js
Created June 10, 2017 13:28
Download stuffs from app.box
a = $("iframe").contents().find("svg")
b="<!DOCTYPE html><html><head><title></title></head><body>"
for (i = 0; i < a.length; i++) {
b +=a[i].outerHTML;
}
b+="</body></html>"
schema.pageSchema=new mongoose.Schema({
timestamp:Date,
hash:String,
text:String,
user_id:Number
});
schema.chapterSchema=new mongoose.Schema({
title:String,
page:[schema.pageSchema],
@danieltanfh95
danieltanfh95 / mcc_bahasa_f.py
Last active October 6, 2015 13:40
shorter answer for bahasa f
test="cu/a/ca ha/ri i/ni san/gat pa/nas"
def split_words(sentence):
return map(lambda x : x.split("/"), sentence.split())
def generate_f(syllable):
return syllable+"f"+ (syllable[1:] if syllable[0] not in "aeiou" else syllable)
print(" ".join("".join(map(generate_f, word)) for word in split_words(test)))