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
""" | |
http_client.py | |
A reusable HTTP client wrapper for making API requests with default settings. | |
Features: | |
- Supports GET, POST, PUT, and DELETE requests. | |
- Automatically applies a base URL, timeout, and default headers. | |
- Handles request errors gracefully. |
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
""" | |
Middleware for Logging AWS Lambda Requests | |
This module implements a middleware for logging AWS Lambda function | |
requests and responses using AWS Lambda Powertools. It provides | |
automatic logging of request metadata, including headers, query | |
parameters, source IP, execution time, and response details. | |
Requires: Python 3.10+ |
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
// ==UserScript== | |
// @name Teams Copy Enabler | |
// @namespace http://tampermonkey.net/ | |
// @version 2024-12-09 | |
// @description Allow Copy and Right Click in Teams | |
// @author Mohamed Riyad | |
// @match https://teams.live.com/** | |
// @match https://teams.microsoft.com.mcas.ms/** | |
// @run-at document-start | |
// @icon https://statics.teams.cdn.live.net/evergreen-assets/icons/microsoft_teams_logo_refresh.ico |
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 timeElapsed(t__, input, isUnixTimestamp = true, mostSignificantOnly = 1) { | |
let seconds; | |
if (isUnixTimestamp) { | |
const now = Math.floor(Date.now() / 1000); // Current time in seconds | |
seconds = now - input; // Calculate the difference in seconds | |
// If the time difference is negative (future time), use absolute value | |
if (seconds < 0) seconds = Math.abs(seconds); | |
} else { |
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 populateSelectWithGroups(data, valueKey = 'value', contentKey = 'content', checkedKey = 'checked', maxSelectionsPerGroup = null, maxSelections = null) { | |
const $selectElement = $('#prerequisite_id'); | |
// Clear existing options | |
$selectElement.empty(); | |
// Loop through the object to create and append option groups | |
$.each(data, function(groupLabel, options) { | |
// Create the optgroup element using jQuery | |
const $optGroup = $('<optgroup>').attr('label', groupLabel); |
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
// | |
// DeviceModelManager.swift | |
// A utility struct for managing device model mappings based on hardware machine identifiers. | |
// | |
// @author Mohamed Riyad <[email protected]> | |
// @link https://RyadPasha.com | |
// @license MIT | |
// | |
import Foundation |
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
/** | |
* MultiSourceTranslator is a class that provides translation capabilities with support for multiple sources, such as | |
* file-based translations and database translations. It allows you to load translations for multiple languages and | |
* supports string interpolation using placeholders. | |
* | |
* @class MultiSourceTranslator | |
* @author Mohamed Riyad <m@ryad.dev> | |
* @link https://RyadPasha.com | |
* @copyright Copyright (C) 2023 RyadPasha. All rights reserved. | |
* @license MIT |
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 util from 'util' // In TS | |
// Or | |
import { inspect } from 'util' // Directly (TS) | |
// Or | |
const util = require('util') // In JS | |
// Or | |
const { inspect } = require('util') // Directly (JS) | |
// Then: | |
console.log(util.inspect(request)) // Or `console.log(inspect(request))` in case you directly imported it |
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
/** | |
* TimeUtility is a utility class that provides a set of methods to handle time-related operations. | |
* | |
* @class DatabaseManager | |
* @author Mohamed Riyad <m@ryad.me> | |
* @link https://RyadPasha.com | |
* @copyright Copyright (C) 2023 RyadPasha. All rights reserved. | |
* @license MIT | |
* @version 1.0.0-2023.07.26 | |
* @see {@link https://momentjs.com/} for more information on Moment.js |
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
/** | |
* Logger class that wraps 'winston' and provides custom | |
* logging capabilities with different log levels. | |
* | |
* @class Logger | |
* @author Mohamed Riyad <m@ryad.dev> | |
* @link https://RyadPasha.com | |
* @copyright Copyright (C) 2024 RyadPasha. All rights reserved. | |
* @license MIT | |
* @version 1.0.2-2024.01.03 |
NewerOlder