Skip to content

Instantly share code, notes, and snippets.

View fmtarif's full-sized avatar

Faisal Muhammad fmtarif

View GitHub Profile
@secrethash
secrethash / composer.json
Last active January 13, 2023 02:18
Laravel Helper Function to create a Unique slug based on Provided Model Instance. Save 'slugify_model.php' in your 'app/Helpers/' directory and update your composer.json to reference and autoload the helper function.
{
...
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
},
"files": [
...
@ConorSheehan1
ConorSheehan1 / standup.sh
Last active July 7, 2023 14:17
bash script to show git commits for a standup.
# show commits from all branches for current git user.
function my-commits-since() {
git log --all --author=$(git config user.email) --since=$@
}
# show commits from yesterday.
# if none were found, assume it's Monday and show commits from Friday.
function standup() {
if [ -z "$(my-commits-since yesterday)" ]; then
my-commits-since last.friday.midnight $@;
@bradtraversy
bradtraversy / webdev_online_resources.md
Last active June 25, 2024 22:17
Online Resources For Web Developers (No Downloading)
@jeffochoa
jeffochoa / Response.php
Last active May 22, 2024 04:06
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@avataru
avataru / EloquentCheatSheet.md
Last active May 31, 2024 08:01
Eloquent relationships cheat sheet
@sohelamin
sohelamin / socket.io-cheatsheet.md
Last active July 4, 2023 21:22
Socket.io Cheatsheet

sending to sender-client only

socket.emit('message', "this is a test");

sending to all clients, include sender

io.emit('message', "this is a test");
@fmtarif
fmtarif / baseModel.php
Last active April 19, 2022 11:53
#laravel #php A query scope for sorting and searching/filtering
<?php
/**
* Use this query scope from any model/controller
* It works on single table only, so for joined columns, make a mysql view and operate on that
* Example request fromat
*/
/*
[
'query' => [
@sinedied
sinedied / angular.md
Last active November 8, 2023 22:53
The Missing Introduction to Angular 2 and Modern Design Patterns

Introduction to Angular

Angular (aka Angular 2) is a new framework completely rewritten from the ground up, replacing the famous AngularJS framework (aka Angular 1.x).

More that just a framework, Angular should now be considered as a whole platform which comes with a complete set of tools, like its own CLI, debug utilities or performance tools.

Getting started

@odan
odan / php-pdo-mysql-crud.md
Last active December 8, 2020 23:24
Basic CRUD operations with PDO and MySQL
@zaccb
zaccb / install-choco-script.bat
Last active December 10, 2023 08:54
Chocolatey install script
:: Install choco .exe and add choco to PATH
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
:: Install all the packages
:::: Browsers
choco install googlechrome -fy
choco install firefox -fy
:::: Text editors / IDEs
choco install atom -fy