Skip to content

Instantly share code, notes, and snippets.

View hassanjamal's full-sized avatar
🚀
Working from home

Hassan Jamal hassanjamal

🚀
Working from home
View GitHub Profile
@hassanjamal
hassanjamal / mysql-docker.sh
Created December 5, 2021 07:56 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@hassanjamal
hassanjamal / gist:fe3e8b8aedd8b85b78f244799e8df1f5
Created February 17, 2020 04:34
Install and config Redis on Mac OS X via Homebrew
By using Homebrew, you greatly reduce the cost of setting up and configuring the development environment on Mac OS X.
Let’s install Redis for the good.
```$ brew install redis```
After installation, you will see some notification about some caveats on configuring. Just leave it and continue to following some tasks on this article.
Launch Redis on computer starts.
```$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents```
Start Redis server via “launchctl”.
```$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist```
Start Redis server using configuration file.
```$ redis-server /usr/local/etc/redis.conf```
@hassanjamal
hassanjamal / Laravel-Container.md
Created September 2, 2019 14:04
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

@hassanjamal
hassanjamal / Validator.php
Created January 26, 2018 16:57 — forked from waleedrehmankhan/Validator.php
Custom Laravel Alphanumeric Validator that allow spaces
Paste this Code in Validator.php
public function validateAlphaSpaces($attribute, $value, $params)
{
return preg_match('/^[\pL\s]+$/u', $value);
}
Create Custom Message some where at bottom in Validation.php
/*
@hassanjamal
hassanjamal / php-code-inspection.md
Created October 3, 2017 10:23
How to install PHP code inspection tools using homebrew-php and how to integrate with JetBrain's IntelliJ or PhpStorm

#Inspection Tools with homebrew-php#

##Prerequisites##

  • Homebrew is installed

##Step 1: Installing homebrew-php##

  1. brew tap homebrew/dupes
  2. brew tap josegonzalez/homebrew-php
  3. brew install PHP53 (or other version of your choice)

Sprint - meeting :

  1. In this meeting we will be deciding all possible features which can be done in upcoming sprint.
  2. Discussion will be whole day. Where we have to decide all possibilities.
  3. Estimate task and decided UI for app. If there is any issue in UI this is the time to point out the mistakes
  4. If there is any issue in API this is the time to point out the issues.
  5. If there is any R&D task, please mention and estimate the R&D task.

How to estimate any task?

  1. Think about the efforts and possibilities. Its not easy to estimate but it comes only with experience. So keep estimating on regular basis one day you will reach there.
  2. Check for existing, if any. To save time and efforts. (Please refer to question how to choose Third party lib)
@hassanjamal
hassanjamal / ds_store_to_gitignore.sh
Created December 9, 2016 08:26
Ignore all DS Store files
echo ".DS_Store" >> ~/.gitignore_global
echo "._.DS_Store" >> ~/.gitignore_global
echo "**/.DS_Store" >> ~/.gitignore_global
echo "**/._.DS_Store" >> ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
@hassanjamal
hassanjamal / overview-for-angular-apps-with-roles-and-permissions.md
Last active September 12, 2015 11:24 — forked from bvaughn/overview-for-angular-apps-with-roles-and-permissions.md
RE: Reddit Angular JS question "Advice on separating the logical parts of an application"

This gist is in response to a question asked on the Reddit Angular JS forum about how to structure an Angular app with roles and permissions.

There are many ways to approach this, but I'll share one that I've used before and maybe it will give you an idea. I'd combine all of the above into a single app and control who gets to see what using permissions. There are a few components to this approach...

A local session service

First off I'd advise creating some sort of local session management service. This should be able to track whether you have an authenticated user and- if so- what types of permissions that user has. (Lots of ways to manage permissions. I'll assume your user object has either a 'role' enum or something simple like an array of string permissions.) You could roll your own session service or you could check out something like satellizer.

Let's assume yo

@hassanjamal
hassanjamal / digital_ocean_setup.md
Last active August 29, 2015 14:27 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions

DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

SSH into Root

$ ssh root@123.123.123.123

Change Root Password

@hassanjamal
hassanjamal / uninstall_gems.sh
Last active August 29, 2015 14:27 — forked from IanVaughan/uninstall_gems.sh
Uninstall all rbenv gems
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}