Skip to content

Instantly share code, notes, and snippets.

View BSN4's full-sized avatar
🎯
Focusing

Bader BSN4

🎯
Focusing
View GitHub Profile
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]: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
@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/
*
@rxaviers
rxaviers / gist:7360908
Last active April 18, 2025 20:59
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@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);
}
@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;
@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>
@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"
}
@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.
@ankurk91
ankurk91 / laravel_horizon.md
Last active January 23, 2025 05:08
Laravel Horizon, redis/valkey-server, supervisord on Ubuntu server

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

Laravel 10+, Horizon 5.x, Redis/Valkey 7+

Prepare 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 dashboard

Install redis-server

@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(/-+$/, '');
}