Skip to content

Instantly share code, notes, and snippets.

View rehmatworks's full-sized avatar
👨‍💻
python manage.py domagic

Rehmat Alam rehmatworks

👨‍💻
python manage.py domagic
View GitHub Profile
@rehmatworks
rehmatworks / spatie-laravel-role-permission-example.php
Last active July 20, 2018 11:01
An example usage of Spatie role and permissions for Laravel
<?php
use App\User;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
$editorRole = Role::create(['name' => 'Editor']);
$userRole = Role::create(['name' => 'User']);
$adminRole = Role::create(['name' => 'Admin']);
// Permissions
@rehmatworks
rehmatworks / android-apps-games-categories-as-json.json
Last active February 2, 2018 12:21
I took these categories (main and sub-categories) from an official page of Google and transformed them into a JSON file. The purpose was to use these categories in my Android Apps and Games Market website https://apkbucket.net. I'm putting this as a gist for public with an intention that this might help someone else too.
[
{
"name": "Apps",
"children": [
{
"name": "Art & Design",
"description": "Sketchbooks, painter tools, art & design tools, coloring books"
},
{
"name": "Auto & Vehicles",
@rehmatworks
rehmatworks / ufr.sh
Last active September 14, 2017 17:38
#!/bin/bash
printf "Original String: "
read -r ufr_oristring
if [[ -z "$ufr_oristring" ]]
then
echo -e "\e[31mPlease provide the original string that needs to be replaced\e[39m"
exit
fi
printf "New String (This will replace the Original String): "
@rehmatworks
rehmatworks / itunes-category-list.json
Last active November 20, 2020 16:41
I needed the up-to-date list of iTunes categories (as of 2017) for a project but didn't find the list as a JSON anywhere. Here I'm sharing the latest categories list that I extracted from iTunes official page. I hope this helps someone.
{
"1": {
"name": "Arts",
"sub": [
"Design",
"Fashion & Beauty",
"Food",
"Literature",
"Performing Arts",
"Visual Arts"
@rehmatworks
rehmatworks / tokdis.sh
Last active August 22, 2017 09:55
A simple script to easily install token dispenser on an Ubuntu server
#!/bin/bash
################################################################
# A simple script to install Token Dispenser on an Ubuntu server
# Author: Rehmat Alam
# Website: https://supportivehands.net
################################################################
read -p "Gmail ID: " gmailAddress
read -p "Account Password: " accountPassword
read -p "Server's Public IP: " serverIP
#!/usr/bin/php
<?php
#########################################################
# Name: WebDav Recursive Upload #
# Description: Uploads files and directories #
# to a remote WebDav machine recursively #
# Author: Rehmat Alam #
# Website: https://rehmat.works #
#########################################################
require_once ('/path/SimpleShortcodes.php');
$simpleshortcodes = new SimpleShortcodes();
$shortcodes = array('[name]' => '{$name}');
$simpleshortcodes->add($shortcodes);
// An array that contains user information. You can use multidimensional arrays to include more details about the user
$users = array('User 1', 'User 2', 'User 3', 'User 4', 'User 5');
$message = 'Hello [name], we are here with the introduction to our newest product. Blah blah blah...';
echo $simpleshortcodes->read($message); // Will print Hello Rehmat, do you live in Pakistan?
echo $message; // Prints out Hello [first_name], do you live in [user_country]?
$message = 'Hello [first_name], do you live in [user_country]?';