Skip to content

Instantly share code, notes, and snippets.


Amir Hassan Azimi hassanazimi

View GitHub Profile
hassanazimi / calculate_profile_percentage.php
Last active Feb 23, 2021
Calculates how much percentage of a profile is completed. It stripes off timestamps like created_at updated_at and primary keys like ids. Usually beneficial when using Laravel
View calculate_profile_percentage.php
* Calculate how much a profile is completed
* @param $profile
* @return float|int
function calculate_profile($profile)
if ( ! $profile) {
View disposable_email_addresses

Install Supervisor with sudo apt-get install supervisor in Unix or brew install supervisor in Mac OSX. Ensure it's started with sudo service supervisor restart in Unix or brew services start supervisor in Mac OSX.

In Unix in /etc/supervisord/conf.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

In Mac OSX first run supervisord -c /usr/local/etc/supervisord.ini and in /usr/local/etc/supervisor.d/ create a .conf file. In this example, laravel_queue.conf (contents below). Give it execute permissions: chmod +x laravel_queue.conf.

This file points at /usr/local/bin/, so create that file there. Give this execute permissions, too: chmod +x

Now update Supervisor with: sudo supervisorctl reread in Unix and with: brew services restart supervisor in MAc OSX . And start using those changes with: sudo supervisorctl update.

hassanazimi / NewObjectValueUpdated.js
Created Nov 17, 2020
This lodash function will find the key value in any object and it will add/update [title] key/value
View NewObjectValueUpdated.js
_.set(_.find(events, { id: 1 }), 'title', 'New title');
View MaterialTheme.xccolortheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>0.319563 0.371489 0.414287 1</string>
<string>FiraCode-Regular - 12.0</string>
<string>0.319563 0.371489 0.414287 1</string>
hassanazimi / .htaccess
Last active Jun 9, 2020
The Best .htaccess with browser caching and gzip
View .htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
hassanazimi /
Created Aug 9, 2018 — forked from radermacher/
Laravel Forge Setup Script
# - server (the forge server instance)
# - event (the forge event instance)
# - sudo_password (random password for sudo)
# - db_password (random password for database user)
# - callback (the callback URL)
hassanazimi /
Created Apr 26, 2020 — forked from fijimunkii/
brew: unlink and re-link all formulas and kegs
hassanazimi / Form.js
Last active Apr 26, 2020
Axios Form Class for use with Vue.js
View Form.js
class Errors {
* Create a new Errors instance.
constructor() {
this.errors = {};
* Determine if an errors exists for the given field.
hassanazimi / _spacing-helpers.scss
Last active Feb 5, 2020 — forked from jacurtis/_spacing-helpers.scss
SASS Margin and Padding Helpers Loop.
View _spacing-helpers.scss
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects.
It will generate several classes such as:
.mr-10 which gives margin 10 pixels.
.pb-5 gives PADDING 5 pixels
The first letter is "m" or "p" for MARGIN or PADDING
Second letter is "t", "b", "l", or "r" for TOP, BOTTOM, LEFT, or RIGHT
Third letter is the number of spacing in pixels. Adjust the amounts generated by editing the $spaceamounts variable below.