Skip to content

Instantly share code, notes, and snippets.

View MaherSaif's full-sized avatar

Maher Saif MaherSaif

View GitHub Profile
@MaherSaif
MaherSaif / PROMPT.txt
Created February 17, 2025 19:01 — forked from peterc/PROMPT.txt
Prompt to start a software engineering debate about a proposed app idea
You simulate a group of expert software developers, engineers and architects who debate and analyze an application development idea in order to ultimately produce a robust spec. Each participant has a unique perspective, engages in natural discussion, and refines ideas through back-and-forth exchange. The goal is to explore concepts, challenge assumptions, and reach well-reasoned conclusions.
This is an on-going conversation between an external user who is asking for a piece of software to be built and the group of experts.
## Output Format
1. Simulate a technical debate** where ideas and answers emerges organically.
2. Use a play script style where when someone speaks, their name is included at the start of each line.
3. You must end with a pertinent question for the user to answer in order to productively continue the debate. Format the answer like so: "QUESTION: Question goes here." This must be the very final paragraph of your response.
4. If the group is satisfied they have all the answers needed to pr
@MaherSaif
MaherSaif / dio_exception.md
Created October 30, 2024 06:19 — forked from shakthizen/dio_exception.md
Unable to catch Flutter Dio exception

I found a hacky solution. We are overriding all the exceptions thrown by default. Then we are going to create custom interceptor to handle and throw exceptions. This way we can catch the DioException as we did before.

  1. Create a base client like this. You have to set validateStatus function to return true whatever the status code is.
final baseOptions = BaseOptions(
  baseUrl: host,
  contentType: Headers.jsonContentType,
  validateStatus: (int? status) {
    return status != null;
    // return status != null && status >= 200 && status < 300;
@MaherSaif
MaherSaif / compress_video
Created August 22, 2024 11:36 — forked from trvswgnr/compress_video
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in
@MaherSaif
MaherSaif / service.rb
Created August 6, 2024 12:22 — forked from kyrylo/service.rb
How to define service objects in Rails: the simple way
# frozen_string_literal: true
class ApplicationService
def self.call(...)
new(...).call
end
def initialize(...)
end
end
@MaherSaif
MaherSaif / collect_all_files.py
Created July 26, 2024 07:09 — forked from tarekbadrsh/collect_all_files.py
Multi-File Commenter and Combiner
import os
import fnmatch
def get_comment_prefix(filename):
extension_to_comment = {
'.asm': (';', ';'),
'.awk': ('#', '#'),
'.c': ('//', '//'),
'.clj': (';;', ';;'),
'.cpp': ('//', '//'),
# In your Gemfile
gem "localhost"

# Then, depending on your desired server
gem "falcon"
gem "puma"
@MaherSaif
MaherSaif / monitor.sh
Created April 23, 2024 21:56 — forked from abreujp/monitor.sh
monitor.sh
#!/bin/sh
# link UMC (Universal Modeline Calculator):
# https://sourceforge.net/projects/umc/files/umc/umc-0.2/umc-0.2.tar.gz/download
# compile umc with: "./configure" and "sudo make install" if error install dependencies and repeat.
# chmod +x monitor.sh
# ./monitor.sh
# Alias on .zshrc
# alias monitor='~/monitor.sh'
@MaherSaif
MaherSaif / convert_to_webp.rb
Created April 11, 2024 20:55 — forked from julianrubisch/convert_to_webp.rb
Ruby Oneliners to convert images to webp and generate thumbnails
require 'fileutils'
# Loop through all .jpg and .png files in the current directory
Dir.glob("{*.jpg,*.png}").each do |img|
# Construct the output filename with .webp extension
output_filename = "#{File.basename(img, File.extname(img))}.webp"
# Execute ffmpeg command to convert the image
system("ffmpeg -i '#{img}' '#{output_filename}'")
end
@MaherSaif
MaherSaif / install_vector.sh
Created April 6, 2024 00:22 — forked from stympy/install_vector.sh
Honeybadger Insights config for Hatchbox.io
#!/bin/bash
if [ "$UID" == "0" ]; then
sudo_cmd=''
else
sudo_cmd='sudo'
fi
bash -c "$(curl -sL https://setup.vector.dev)"
@MaherSaif
MaherSaif / broadcastable.rb
Created March 29, 2024 18:14 — forked from hopsoft/broadcastable.rb
Broadcastable model concern/mixin
# frozen_string_literal: true
module Broadcastable
extend ActiveSupport::Concern
def prepend_operation(options = {})
operation = {html: ApplicationController.render(partial: to_partial_path, locals: locals)}
operation.merge options
end