Skip to content

Instantly share code, notes, and snippets.

View BSN4's full-sized avatar
🎯
Focusing

Bader BSN4

🎯
Focusing
View GitHub Profile
@BSN4
BSN4 / gist:7f0e8f7fef1e2579a92d90cde8bff830
Created March 8, 2023 01:45
Tailwind CSS: Creating Shimmer Loading Placeholder (Skeleton)
<body class="p-20">
<div class="grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
<div class="w-full bg-white drop-shadow-md rounded-lg">
<div class="animate-pulse w-full h-48 bg-slate-200"></div>
<div class="p-3 space-y-4">
<div class="animate-pulse w-2/3 h-6 bg-slate-200"></div>
<div class="flex space-x-4">
<div class="animate-pulse w-1/3 h-3 bg-sky-200"></div>
<div class="animate-pulse w-1/3 h-3 bg-sky-200"></div>
<div class="animate-pulse w-1/3 h-3 bg-sky-200"></div>
@BSN4
BSN4 / pm2-ipc.js
Created January 8, 2023 03:08 — forked from nethoncho/pm2-ipc.js
pm2 IPC Minimum needed to send message to process
/*
The online documents were not very clear.
http://pm2.keymetrics.io/docs/usage/pm2-api/#send-message-to-process
https://stackoverflow.com/a/35504369/3386260
https://github.com/pm2-hive/pm2-hive.github.io/pull/117
*/
// Sender
// The sender can run inside or outside of pm2
var pm2 = require('pm2');
@BSN4
BSN4 / forge.sh
Created August 19, 2022 22:31 — forked from pLavrenov/forge.sh
Laravel Forge Setup Script (July 2020) - NGINX + MySQL
# Replace!
# [!server!] (the forge server instance)
# [!sudo_password!] (random password for sudo)
# [!db_password!] (random password for database user)
# [!user.name!] (git user name)
# [!user.email!] (git user email)
# [!server_ip!] (git user email)
#
# REQUIRES:
@BSN4
BSN4 / migrate-from-php-to-python.md
Last active May 29, 2022 02:16 — forked from Jiab77/migrate-from-php-to-python.md
Migrate from PHP to Python

Migrate from PHP to Python

Hi all, recently I've decided to move on and learn Python programming. At first, I though that it would be very difficult but in fact... Not that much. So I've decided to write this little gist and show the main differences between both languages.

I will use try to follow the same order used on this website: https://pythonprogramming.net/introduction-to-python-programming/. It was really usefull to improve my understanding of Python programming.

To finish, I'm assuming that you already got basic knowledge in Object Oriented Programming and already got skills and understanding of PHP programming. This is not intended to explain you how to code in PHP but if you're coming from Python programming, then this gist might help you to migrate from Python to PHP.

Official documentations

@BSN4
BSN4 / cloudSettings
Last active July 8, 2020 19:44
SETTINGS.json
{"lastUpload":"2020-07-08T19:03:47.131Z","extensionVersion":"v3.4.3"}
@BSN4
BSN4 / disable.sh
Created February 6, 2020 21:01
Disable bunch of #$!@ in Catalina
#!/bin/bash
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
@BSN4
BSN4 / disable.sh
Created September 10, 2019 05:19
Disable bunch of #$!@ in Sierra (Version 2.1)
#!/bin/bash
# IMPORTANT: You will need to disable SIP aka Rootless in order to fully execute this script, you can reenable it after.
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
# Agents to disable
TODISABLE=('com.apple.security.keychainsyncingoveridsproxy' 'com.apple.personad' 'com.apple.passd' 'com.apple.screensharing.MessagesAgent' 'com.apple.CommCenter-osx' 'com.apple.Maps.mapspushd' 'com.apple.Maps.pushdaemon' 'com.apple.photoanalysisd' 'com.apple.telephonyutilities.callservicesd' 'com.apple.AirPlayUIAgent' 'com.apple.AirPortBaseStationAgent' 'com.apple.CalendarAgent' 'com.apple.DictationIM' 'com.apple.iCloudUserNotifications' 'com.apple.familycircled' 'com.apple.familycontrols.useragent' 'com.apple.familynotificationd' 'com.apple.gamed' 'com.apple.icloud.findmydeviced.findmydevi
@BSN4
BSN4 / laravel_horizon.md
Created August 23, 2019 23:09 — forked from ankurk91/laravel_horizon.md
Laravel Horizon, redis-server, supervisord on Ubuntu server

Laravel Horizon, redis-server, supervisord on Ubuntu 16/18 server

Laravel 5.8, Horizon 3.x, Redis 5.x

Parepare application

  • Install and configure Laravel Horizon as instructed in docs
  • Make sure you can access the Horizon dashboard like - http://yourapp.com/horizon
  • For now it should show status as inactive on dashbaord

Install redis-server

@BSN4
BSN4 / moveredis
Created June 29, 2019 17:59
move redis keys from db to another
redis-cli keys '*' | xargs -I % redis-cli move % 3 > /dev/null
@BSN4
BSN4 / chain_helper.php
Created January 30, 2019 21:42 — forked from calebporzio/chain_helper.php
Handy "chain()" helper method for making non-fluent classes/objects fluent.
<?php
function chain($object)
{
return new class ($object) {
public function __construct($object)
{
$this->wrapped = $object;
}