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
| /** | |
| * Generate a random string with a given lenth | |
| * | |
| * @author <@thehomelessdev> | |
| * @version 1.0.1 | |
| * | |
| * @example | |
| * // returns ten random characters including numbers and special characters | |
| * generateRandomString(10, { includeSpecialCharacters: 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
| /** | |
| * Async function to replace words between brackets | |
| * | |
| * E.g. | |
| * replaceBrackets( | |
| * "Hey, {{ name }}. We just sent your authentication code to {{ email||phoneNumber }}", | |
| * { | |
| * name: "Jhon Doe", | |
| * email: "[email protected]" | |
| * } |
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
| import tweepy | |
| # You can get this credentials from your tweeter developer account | |
| consumer_key = 'xxxxxxxxxxxxxxxxx' | |
| consumer_secret = 'xxxxxxxxxxxxxxxxxxx' | |
| key = 'xxxxxxxxxxxxxx-xxxxxxxxxxxxx' | |
| secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | |
| auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
| try: |
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
| import random | |
| import timeit | |
| from typing import List, Optional | |
| import unittest | |
| # simple binary search algrothim. requires a sorted list function | |
| def binary_search(sorted_list: List[str], target: str) -> Optional[int]: | |
| left, right = 0, len(sorted_list) - 1 | |
| while left <= right: |
OlderNewer