brew tap shivammathur/php
brew install shivammathur/php/[email protected]
brew install [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
def fibonacci(n): | |
fib = [0] * (n + 1) | |
fib[0] = 0 | |
fib[1] = 1 | |
for i in range(2, n + 1): | |
fib[i] = fib[i - 1] + fib[i - 2] | |
return fib[n] |
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 time | |
import random | |
# golden Ratio constant | |
phi = 1.6180339887 | |
def exponential_backoff_with_phi(max_retries=5, base_delay=1): | |
""" | |
Retries an operation with exponential backoff using the golden ratio (phi). |
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 pretty_format(current: int, total: int): | |
total_str = str(total) | |
current_length = len(total_str) | |
current_str = str(current).zfill(current_length) | |
formatted_string = f"{current_str}/{total_str}" | |
return formatted_string | |
# xxample usage | |
print(pretty_format(1, 56)) # Output: 01/56 | |
print(pretty_format(1, 120)) # Output: 001/120 |
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 time import sleep | |
from math import ceil | |
from os import get_terminal_size | |
def main(): | |
for i in range(100): | |
sleep(0.1) | |
print(f'\r{str(ceil(i/100*100)).strip()} % complete', end='') | |
print(f'\r{' ' * get_terminal_size().columns}', end='') # clear the line before displaying the next line | |
print('\r100% complete', end="\n") |
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
/** | |
* Metadata Reflection Demo by https://github.com/ludndev | |
*/ | |
const reportClass: any[] = [] | |
function report(constructor: Function) { | |
reportClass.push(constructor.name) | |
} |
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
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Merge request","url":"https://gitlab.com/organization-name/repository-name/-/merge_requests/123"}}</script> | |
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
# check if token exists and is valid, return RPC with bool and user_id | |
query = r""" | |
select NOW() as n_direct, NOW() AT TIME ZONE 'UTC' as n_utc; | |
""" | |
cur.execute(query, (hashed_token,)) | |
result = cur.fetchone() | |
cur.close() | |
print(result) |
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
// https://play.vuejs.org/#eNp9Vc1y2zgMfhWMLpIzsZT9OXnjzni73k7aJG7TNIdWPbASZCuRSA1J2fF4/O4FSVGSm7Y6SCDwAfwAAtQhWDRNvG0xmAWXGuumYhpfpRzgMi+3ViBRYYWZhu20LOZpsPr2SKv4CfcqEo0uBVeTuEK+1ps06FzIyZnAr4HcCyHJP9qyqsVzoAATKDl0MdJghJ2RkaD0PlVbVzLY76nJkcTcucF8PgevSgOP6+kBHA5go8Dx2HNOHBefd+IC+GVDKWCl8NW1YHnJ13EcXyaNq1biynWZjIpIS5XJsjEB8LkRUkOOBWsrDQfjlDPNoomTASTqVnK/Al+WGRyO517nE5pBGHbK4z/m6yBM7XkGtWg5YYbIWu6HsBnF1LSZakhAmAPbsVJDgTrbROFG60bNkiTfc1aX2bRm+6LaT7mQNativpbiaVpIxJg1TcKaMsk2mD01ouRahefDLgA16o0wRN8s7z1X82yQ5ShNWoMOIHSh1VPZTL9JsVMopzsmOVU5pBh/hAO4P63jxKY+JGXq2SfkM4wfleDRAE3OzkY9MOaQBkoz3arXIqfWmsGfFxcj3sZeo1JsbY1p8J/ZjQ5NlrjFHFSbZWQu2qqinv3B0TAzXif7GcPnq5v7lYvXiSeeBvKwultcO0gnvoDcLK8/XH10GC+/AN0v7j49dHt5+QXozeJmeduBvPwC9O7q4XZ150BeHmP6ExqJZ4mXygIiU494qLYdVip337G2azelirshoFO1LubVn2QH8TNBmPHN1OMnXy6+jnxMq4gK40qsI+vfjeTQIUcwQ35KhVoSOO5gKaWQUWg/bmaoQy23GbW/3bNrklG8blAhY4SHCI3zKFXPyOqj8H8TFezCxHToLpgNRS8z9HQ7+cvFXDR6XyGoTDSYkyY5g0WeA+N7sBZFcyfR1J4j5lQscx4UwdgIHpwHmnx5Ua7tvNDfwNJLg0zUTVmhXPlLum/iNGBVJXZvrU5LutG93t4JP9E/q |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src="https://cdn.kkiapay.me/k.js"></script> | |
</head> | |
<body> |