Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Azzawie's full-sized avatar
💾
keep it simple, stupid

Mustafa Azzawie Azzawie

💾
keep it simple, stupid
View GitHub Profile
@Azzawie
Azzawie / ArrayObjectDemo.coffee
Created April 20, 2022 23:24 — forked from frane/ArrayObjectDemo.coffee
Traversing arrays and objects in CoffeeScript
# Traversing arrays and objects in CoffeeScript
# The array and object we use for testing
arr = [1, 2, 3, 4, 5]
obj = {a: 1, b: 2, c: 3, d: 4, e: 5}
# 'in' has a different meaning in CoffeeScript than in JavaScript
# CS: element in array -> JS: array.indexOf(element) >= 0
console.log '5 in arr: ' + (5 in arr)
@Azzawie
Azzawie / rails http status codes
Created September 2, 2021 18:32 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@Azzawie
Azzawie / QRCODE.MD
Last active October 6, 2020 14:19
QRCODE
  • How to generate a QR code with ruby script
require 'rqrcode'

# qrcode = RQRCode::QRCode.new("mailto:<mwmaki2@gmail.com>?query")
qrcode = RQRCode::QRCode.new("")

png = qrcode.as_png(
  bit_depth: 1,
 border_modules: 4,
@Azzawie
Azzawie / bash_tricks.md
Last active October 5, 2020 01:59
bash_tricks
  1. Select which branch to deploy to
      alias deploy='deploy_webport_to_qa'
      function deploy_webport_to_qa {
        BRANCH=$1
        if [ "$BRANCH" = "" ]; then
          BRANCH=$(git branch --show-current)
          echo "No branch specified."
          echo "Using currently checked out: $BRANCH"

echo "Press enter to continue or ctl-c to quit"

@Azzawie
Azzawie / mysql.rake
Created June 27, 2020 04:19 — forked from dfl/mysql.rake
rails rake tasks for dumping and reloading mysql databases
# mysql db backup and restore for rails
# by David Lowenfels <david@internautdesign.com> 4/2011
require 'yaml'
namespace :db do
def backup_prep
@directory = File.join(RAILS_ROOT, 'db', 'backup')
@db = YAML::load( File.open( File.join(RAILS_ROOT, 'config', 'database.yml') ) )[ RAILS_ENV ]
@db_params = "-u #{@db['username']} #{@db['database']}"
@Azzawie
Azzawie / db_backup.rb
Created June 27, 2020 04:15 — forked from ahmadhasankhan/db_backup.rb
MySQL DB backup script in Ruby CMD
#1===========First code================
#!/usr/bin/env ruby
databases = {
:local_db => {
:database => 'my_db',
:username => 'root',
:password => 'admin',
:host => 'localhost'
@Azzawie
Azzawie / auth.dart
Created April 2, 2020 04:28 — forked from nikhilmufc7/auth.dart
Firebase Flutter Platform Exception Codes and example
// Error Codes for SignUp
ERROR_OPERATION_NOT_ALLOWED` - Indicates that Anonymous accounts are not enabled.
ERROR_WEAK_PASSWORD - If the password is not strong enough.
ERROR_INVALID_EMAIL` - If the email address is malformed.
ERROR_EMAIL_ALREADY_IN_USE - If the email is already in use by a different account.
ERROR_INVALID_CREDENTIAL` - If the [email] address is malformed.
// sending password reset email
ERROR_INVALID_EMAIL` - If the [email] address is malformed.
@Azzawie
Azzawie / emulator-install-using-avdmanager.md
Created March 27, 2020 08:01 — forked from mrk-han/emulator-install-using-avdmanager.md
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For generic skin emulator with default apis (without google apis):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-29;default;x86"

@Azzawie
Azzawie / .bash_aliases
Created February 12, 2020 19:46 — forked from MyklClason/readme.md
List of useful terminal bash aliases for Ruby On Rails, Cloud9, Git and more. What are bash aliases: http://www.tldp.org/LDP/abs/html/aliases.html What does && and ; do? http://unix.stackexchange.com/a/304258
# About Aliases:
alias ls='ls --color=auto -F'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias less="less -R "
@Azzawie
Azzawie / sidekiq.service
Created March 23, 2019 07:03 — forked from mkhuda/sidekiq.service
Sidekiq service auto start for Ubuntu 16.04 using Systemd
#
# Sidekiq auto start using systemd unit file for Ubuntu 16.04
#
# Put this in /lib/systemd/system (Ubuntu).
# Run:
# 1. systemctl enable sidekiq (to enable sidekiq service)
# 2. systemctl {start,stop,restart} sidekiq (to start sidekiq service)
#
# This file corresponds to a single Sidekiq process. Add multiple copies
# to run multiple processes (sidekiq-1, sidekiq-2, etc).