Skip to content

Instantly share code, notes, and snippets.

View JunaidQadirB's full-sized avatar
🎯
Social Media Fasting

Junaid Qadir JunaidQadirB

🎯
Social Media Fasting
View GitHub Profile
@JunaidQadirB
JunaidQadirB / block_regex
Created January 30, 2014 08:15
Regex snippet to find a any block of code.
(.*)\{(.|\n)*?}
Reference: http://stackoverflow.com/questions/159118/how-do-i-match-any-character-across-multiple-lines-in-a-regular-expression
@JunaidQadirB
JunaidQadirB / main.yml
Created January 4, 2021 18:23
Github Action to deploy a Laravel App from release tag
name: CD
on:
release:
types:
- released
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@JunaidQadirB
JunaidQadirB / switchphp.sh
Created September 8, 2023 10:22
Switch PHP Versions
#!/bin/bash
php_new_version=$1
if [ -z "$php_new_version" ]
then
echo "Please enter which PHP version do you want to switch to."
exit 1
fi
@JunaidQadirB
JunaidQadirB / watch.py
Created May 29, 2023 05:29
Watch - A simple script to watch for changes in a python file and run it.
import argparse
import subprocess
import time
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
'''
Watch - A simple script to watch for changes in a python file and run it.
Usage: python watch.py [script_file]
<?php
// UserViewModel.php
class UserViewModel extends ViewModel
{
public User $user;
public function __construct(User $user)
{
$this->user = $user;
@JunaidQadirB
JunaidQadirB / jquery.plugin-boilerplate.js
Created December 12, 2012 16:38
Use this boilerplate to instantly get started with jQuery plugin development.
/**
* A jQuery plugin boilerplate.
* Author: Jonathan Nicol @f6design
*/
;(function($) {
var pluginName = 'demoplugin';
function Plugin(element, options) {
var el = element;
var $el = $(element);
@JunaidQadirB
JunaidQadirB / README.md
Last active August 29, 2022 14:48
Extended version of Tags example. Implemented using Bootstrap5

This is an extended version of the tags example in the alpine.js repository with `Bootstrap5. My implementation is a bit comprehensive with the following features:

  • It doen't allow duplicate tags
  • Adding duplicate tag would throw a nice error
  • All tags can be cleared at once
  • It will prompt when clearing all tags

Demo

Here's the demo https://imgur.com/KGf95Fa

<?php
/**
*
* @link https://github.com/codex-team/editor.js/issues/676#issuecomment-587462314
*/
namespace App\Traits;
@JunaidQadirB
JunaidQadirB / config.php
Created May 22, 2014 07:36
Enable Class loading with Namespaces in CodeIgniter
/*
* Append this to the end of your application/config.php
* @see http://stackoverflow.com/questions/3700626/namespace-in-php-codeigniter-framework#21858556
*/
spl_autoload_extensions('.php'); // Only Autoload PHP Files
spl_autoload_register(function($classname) {
if (strpos($classname, '\\') !== false) {
@JunaidQadirB
JunaidQadirB / write_permission.md
Created April 7, 2021 07:38
Write Permission

sudo chmod -R ugo+rw path