Skip to content

Instantly share code, notes, and snippets.

View faridfr's full-sized avatar
🎭
Wait for it ...

Farid Froozan faridfr

🎭
Wait for it ...
View GitHub Profile
@matteocrippa
matteocrippa / flutter.md
Last active October 26, 2023 05:47
Flutter Cheatsheet

Flutter

A quick cheatsheet of useful snippet for Flutter

Widget

A widget is the basic type of controller in Flutter Material. There are two type of basic Widget we can extend our classes: StatefulWidget or StatelessWidget.

Stateful

StatefulWidget are all the widget that interally have a dynamic value that can change during usage. It can receive an input value in the constructor or reference to functions. You need to create two classes like:

@BenSampo
BenSampo / deploy.sh
Last active April 30, 2024 03:41
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
@manashcse11
manashcse11 / laravel-collection-group-by-with-sum.php
Last active September 7, 2022 14:50
#Laravel collection #group by with sum
<?php
$collection = collect([
['item_id' => 10, 'status_id' => 1, 'point' => 3],
['item_id' => 11, 'status_id' => 2, 'point' => 2],
['item_id' => 12, 'status_id' => 3, 'point' => 4],
['item_id' => 13, 'status_id' => 3, 'point' => 1],
]);
$grouped = $collection->groupBy('status_id')
->map(function ($item) {
@noelboss
noelboss / git-deployment.md
Last active May 2, 2024 15:47
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@isimmons
isimmons / gist:8202227
Last active March 15, 2024 10:47
Truncate tables with foreign key constraints in a Laravel seed file.

For the scenario, imagine posts has a foreign key user_id referencing users.id

public function up()
{
	Schema::create('posts', function(Blueprint $table) {
		$table->increments('id');
		$table->string('title');
		$table->text('body');