Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Pro

Amir Hassan Azimi hassanazimi

:octocat:
Pro
View GitHub Profile
@hassanazimi
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
<?php
/**
* Calculate how much a profile is completed
*
* @param $profile
* @return float|int
*/
function calculate_profile($profile)
{
if ( ! $profile) {
View disposable_email_addresses
0815.ru
0815.ru0clickemail.com
0815.ry
0815.su
0845.ru
0clickemail.com
0-mail.com
0wnd.net
0wnd.org
10mail.com
View _Laravel_Queue_Supervisor_Instruction.md

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/run_queue.sh, so create that file there. Give this execute permissions, too: chmod +x run_queue.sh.

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
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" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0.319563 0.371489 0.414287 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>FiraCode-Regular - 12.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0.319563 0.371489 0.414287 1</string>
@hassanazimi
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
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
@hassanazimi
hassanazimi / forge.sh
Created Aug 9, 2018 — forked from radermacher/forge.sh
Laravel Forge Setup Script
View forge.sh
#
# REQUIRES:
# - 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
hassanazimi / brew-unlink_relink.sh
Created Apr 26, 2020 — forked from fijimunkii/brew-unlink_relink.sh
brew: unlink and re-link all formulas and kegs
View brew-unlink_relink.sh
@hassanazimi
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
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.