Skip to content

Instantly share code, notes, and snippets.

View BSN4's full-sized avatar
🎯
Focusing

Bader BSN4

🎯
Focusing
View GitHub Profile
@Jiab77
Jiab77 / migrate-from-php-to-python.md
Last active June 27, 2024 21:08
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.

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

@abdumu
abdumu / slugify.js
Last active July 23, 2023 21:24
Javascript function to generate a slug that `respect` Arabic.
function slugify(text) {
return text.toString().toLowerCase()
.replace(/\s+/g, '-')
.replace(/[^\w\u0621-\u064A0-9-]+/g, '')
.replace(/\-\-+/g, '-')
.replace(/^-+/, '').replace(/-+$/, '');
}
@ankurk91
ankurk91 / laravel_horizon.md
Last active May 31, 2024 01:57
Laravel Horizon, redis-server, supervisord on Ubuntu server

Laravel Horizon, redis-server, supervisord on Ubuntu 20/22 server

Laravel 8+, Horizon 5.x, Redis 6+

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 horizon dashbaord

Install redis-server

@abdumu
abdumu / howTo.txt
Last active January 8, 2020 09:18
"This connection is not private" + "Valet" + "iOS Simulator"
-1- edit ~/.composer/vendor/laravel/valet/cli/stubs/openssl.conf
Change:
basicConstraints = CA:FALSE
To:
basicConstraints = CA:TRUE,pathlen:0
save file.
@abdumu
abdumu / .post-merge
Created February 25, 2018 02:44
git hook (.git/hooks/.post-merge) to run a command after `git pull` for laravel by @Abdu1M
##
# git hook to run a command after `git pull` for laravel by @abdu1m
##
# source: https://gist.github.com/sindresorhus/7996717
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
@zaersk
zaersk / main.m
Last active March 29, 2016 06:32
Attempt to login to Instagram using their unofficial API (no OAuth tokens).
//
// main.m
// ER1
//
// Created by @zaersk_ on 7/19/14.
// Copyright (c) 2014 Zaersk. All rights reserved.
//
// Attempt to login to Instagram using their unofficial API (no OAuth tokens).
#import <Foundation/Foundation.h>
@gimenete
gimenete / gist:53704124583b5df3b407
Last active July 31, 2020 16:20
Animated rootViewController transition
// put this in your AppDelegate
- (void)changeRootViewController:(UIViewController*)viewController {
if (!self.window.rootViewController) {
self.window.rootViewController = viewController;
return;
}
UIView *snapShot = [self.window snapshotViewAfterScreenUpdates:YES];
[viewController.view addSubview:snapShot];
self.window.rootViewController = viewController;
@joshhartman
joshhartman / crypt.class.php
Last active November 25, 2022 10:10
Rijndael 256-bit Encryption (CBC) Class
<?php
class Crypt {
private $key;
function __construct($key){
$this->setKey($key);
}
@pgchamberlin
pgchamberlin / DominantColours.php
Last active December 12, 2020 21:11
PHP class to extract dominant colours from an image using K-Means clustering. This features an extremely rough-and-ready (read: inefficient) implementation of K-Means which I wrote to run on PHP < 5.3. If you can use an up-to-date build of PHP then you can take advantage of some proper implementations that proper maths-type people have written f…
<?php
/**
* Dominant colours by k means derived from code by Charles Leifer at:
* http://charlesleifer.com/blog/using-python-and-k-means-to-find-the-dominant-colors-in-images/
*
* MagickWand docs: http://www.magickwand.org/
*
* Color transformation algorithms from EasyRGB: http://easyrgb.com/
*
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream