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
| package com.urmoments.api.utils; | |
| import java.text.ParseException; | |
| import java.text.SimpleDateFormat; | |
| import java.util.Calendar; | |
| import java.util.Date; | |
| import java.util.Locale; | |
| /** | |
| * This class contains methods concerning the Date. It contains a method which |
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
| function log() { | |
| try { | |
| // tries to log the message using the most common method | |
| console.log.apply(console, arguments); | |
| } catch(e) { | |
| // catches any failure in logging | |
| try { | |
| // tries to log the Opera way | |
| opera.postError.apply(opera, arguments); |
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
| public static String readableFileSize(long size) { | |
| if(size <= 0) return "0"; | |
| final String[] units = new String[] { "B", "KB", "MB", "GB", "TB" }; | |
| int digitGroups = (int) (Math.log10(size)/Math.log10(1024)); | |
| return new DecimalFormat("#,##0.#").format(size/Math.pow(1024, digitGroups)) + " " + units[digitGroups]; | |
| } |
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
| package com.litil.utils; | |
| /** | |
| * This class contains methods concerning videos. For now, it can help | |
| * you check if an url is valid and convert a "classic" url to an | |
| * "embed" one. | |
| * | |
| */ | |
| public class VideoUtils { |
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
| // from https://medium.com/@nesbtesh/react-best-practices-a76fd0fbef21 | |
| export const isObjectEqual = (obj1, obj2) => { | |
| if(!isObject(obj1) || !isObject(obj2)) { | |
| return false; | |
| } | |
| if (obj1 === obj2) { | |
| return true; | |
| } |
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
| # -*- coding: utf-8 -*- | |
| import xml.etree.ElementTree as ET | |
| import re | |
| import unicodedata | |
| # This method adds all given synonyms into the correct dictionary entry. | |
| def extendDictEntry(dict, key, xmlSynonyms): | |
| for child in xmlSynonyms: | |
| childText = child.text.encode('utf-8') |