CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

14 February, 2022

Manage Git Branches with git-trim

 Programing Coderfunda     February 14, 2022     Developer Tools, Laravel, php     No comments   

 

Manage Git Branches with git-trim




Manage Git Branches with git-trim








Have you ever needed to clean up stale or old local branches that have already been merged and deleted on GitHub? Jason McCreary has released a CLI tool for organizing local and remote branches:

Cleaning up thousands of dangling references in Git repos everywhere - another "Garbage Man" production. ๐Ÿ—‘๐Ÿ˜Žhttps://t.co/fW4yTkPSJt

— Jason McCreary ๐Ÿ—‘ (@gonedark) February 9, 2022

The git-trim command is a way to quickly remove merged, pruned, untracked, and stale branches in Git repositories:

1# Removes local branches where its remote branch no longer exists
2git trim
3git trim --pruned
4 
5# Removes local branches already merged into the current branch
6git trim --merged
7 
8# Removes local branches without commits in the last 3 months
9git trim --stale
10 
11# Removes local branches not tracking a remote branch
12git trim --untracked
13 
14# Removes all local branches except the current branch (requires confirmation)
15git trim --all

You can also combine these when it makes sense, such as removing merged and stale branches:

1git-trim --merged --stale

You can download and try this command out via NPM or as an Oh-My-Zsh plugin. If you'd like to learn more about the source code, you can check it out on GitHub at jasonmccreary/git-trim.


by  laravel-news . com

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laravel 9 is Now Released!

 Programing Coderfunda     February 14, 2022     Laravel, php     No comments   

Laravel 9 is Now Released!

 Laravel 9 is now released and includes many new features, including a minimum PHP v8.0 version, controller route groups, a refreshed default Ignition error page, Laravel Scout database engine, Symfony mailer integration, Flysystem 3.x, Improved Eloquent accessors/mutators, and many more features.

Before we jump into the new features, we'd like to point out that starting with Laravel 9, Laravel will release a new major version about every twelve months instead of the previous six-month schedule:

Laravel uses a variety of community-driven packages as well as nine Symfony components for a number of features within the framework. Symfony 6.0 is due for release in November. For that reason, we are choosing to delay the Laravel 9.0 release until 2022.

By delaying the release, we can upgrade our underlying Symfony components to Symfony 6.0 without being forced to wait until September 2022 to perform this upgrade. In addition, this better positions us for future releases as our yearly releases will always take place two months after Symfony’s releases.

From the releases support policy documentation, here’s what you can expect going forward with tentative dates of upcoming releases:

VersionPHP (*)ReleaseBug Fixes UntilSecurity Fixes Until
6 (LTS)7.2 - 8.0September 3rd, 2019January 25th, 2022September 6th, 2022
77.2 - 8.0March 3rd, 2020October 6th, 2020March 3rd, 2021
87.3 - 8.1September 8th, 2020July 26th, 2022January 24th, 2023
9 (LTS)8.0 - 8.1February 8th, 2022February 8th, 2024February 8th, 2025
108.0 - 8.1February 7th, 2023August 7th, 2024February 7th, 2025

Laravel 9 is the next long-term support version (LTS) and will receive bug fixes until February 2024 and security fixes until February 2025. Here are some of the major features that we’ve covered in detail in our A look at what is coming to Laravel 9 post:

  • PHP 8 is the minimum version in Laravel 9
  • New Design for routes:list
  • New test --coverage option displays coverage directly in the terminal
  • Anonymous Stub Migrations are now the default
  • New Query Builder Interface
  • PHP 8 String Functions
  • Moved mailer functionality from SwiftMailer to Symfony Mailer
  • Flysystem 3.x
  • Improved Eloquent Accessors/Mutators
  • Implicit Route Bindings With Enums (PHP 8.1)
  • Controller Route Groups
  • Enum Eloquent Attribute Casting
  • Forced Scoped Bindings
  • Laravel Breeze API & Next.js
  • Laravel Scout Database Engine
  • Full-Text Indexes / Where Clauses
  • Rendering Inline Blade Templates
  • Soketi Echo Server
  • Optional Bootstrap 5 Pagination Views
  • Improved Ignition Exception Page
  • New str() and to_route() helper functions

Brand new home page design

Laravel 9 is Now Released

The Laravel website got a fresh new design for the launch of Laravel 9. It was designed by @martinrariga, with Torchlight syntax highlighting that we also use here on this site.

Find out more about Laravel 9.x

These are just a few of the new features in Laravel 9 and to see a complete list check out the Laravel 9 release notes as well as the upgrade guide. Also, don't forget about Laravel Shift if you want an easy way of updating.

If you prefer video format, check out Laracasts: What's New in Laravel 9 also has free videos about this release.

Finally, we'd like to thank everyone who contributes, submits PR’s, shares ideas, and uses the framework. Laravel is genuinely a global team effort.

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

04 February, 2022

Image Optimization in Magento 2: Best Practices

 Programing Coderfunda     February 04, 2022     MAGENTO TUTORIALS     No comments   

Image Optimization in Magento 2: Best Practices

Image Optimization in Magento 2: Best Practices



Performance directly affects your bottom line—and since images are the most frequently requested type of resource on the Web, optimizing images should be the first step that you should think of when trying to improve your Magento store’s conversion rate.

In this tutorial, we will show you ways to optimize images in your Magento store.

One-size-fits-all product images

You can optimize your product images in bulk by running the compression on the image files in /media/catalog/product/.

Here are some tools you should use: GIFSicle, JPEGTran, OptiPNG. These command lines will rewrite your current images to an optimized version without changing the filename. All cached images will also be optimized while you don’t have to refresh the cache.

  • PNG images: Using OptiPNG
    optipng -o7 -strip all media/catalog/product/*.png
  • JPEG images: Using JPEGTran
    find media/catalog/product/ -name "*.jpg" -type f -exec jpegtran -copy none -optimize -outfile {} {} \;
  • GIF images: Using GIFSicle
    gifsicle --batch --optimize=3 media/catalog/product/*.gif

Use the right image format

Using the right image format also helps reduce the file size of your images. Some image formats like JPEG and PNG, for example, are best used for photos and web images, while image formats such as GIF and BMP with their limited (256) colors are more suitable for small resolution files like logos, buttons, icons.

For a better understanding of what image format to use for your image needs, do refer to the chart below:

PurposeBest format(s)
Product imagesJPEG, PNG
LogosSVG
Buttons; iconsGIF

Replace GIFs with Videos

GIF is a cool way to make your content more intriguing, but it may not be the best option if you want to optimize your page load speed. So what’s an alternative method? 

With videos!

You can convert your GIF to an MP4 or WebM video. But you should check if it’s possible to do so by using Google’s Lighthouse. If you have any GIFs that can be converted, you should see a suggestion to “Use video formats for animated content”:

check gif to video
(Source: Google)

The next step is converting your GIF. To get an MP4 video, it’s recommended to use FFmpeg. Run the following command in your console:

ffmpeg -i my-animation.gif -b:v 0 -crf 25 -f mp4 -vcodec libx264 -pix_fmt yuv420p my-animation.mp4

This tells FFmpeg to take my-animation.gif as the input, signified by the -i flag, and to convert it to a video called my-animation.mp4.

In case your GIF’s dimensions are odd, include a crop filter like below:

<code>ffmpeg -i my-animation.gif -vf "crop=trunc(iw/2)*2:trunc(ih/2)*2" -b:v 0 -crf 25 -f mp4 -vcodec libx264 -pix_fmt yuv420p my-animation.mp4</code>

For WebM video, run this command in your console: 

ffmpeg -i my-animation.gif -c vp9 -b:v 0 -crf 41 my-animation.webm

*Note: although a WebM video is smaller than an MP4 video, not all browsers support the format since it’s relatively new.

Convert images to WebP

WebP is a next-generation image format that delivers an exceptional image-quality-to-file-size ratio. Compared to JPG and PNG, WebP images are on average 25 – 35% smaller with next to zero loss in image quality.

webp comparision
JPG image compared to WebP image

However, as the image format is still relatively new, it receives no support in Magento 2 and limited support in browsers such as Safari. To use WebP in your Magento store, you’ll need to use extensions such as Magento 2 WebP Images Extension to enable automatic conversion of your images to WebP. 

Use responsive images

Don’t settle with a ‘one-size-fits-all” approach if you want the best page performance. Instead, try providing different image sizes for different devices.

There are several tools out there which can assist you in the task, but the sharp npm package and the ImageMagick CLI tools are perhaps the most popular.

Sharp (for auto-resize)

To use sharp as a Node script, save this code as a separate script in your project, and then run it to convert your images:

const sharp = require('sharp');
const fs = require('fs');
const directory = './images';

fs.readdirSync(directory).forEach(file => {
 sharp(`${directory}/${file}`)
   .resize(200, 100) // width, height
   .toFile(`${directory}/${file}-small.jpg`);
 });

ImageMagick (for one-off image resizing)

To resize an image to 54% of its original size, run the following command in your terminal:

convert -resize 54% picture.jpg picture-small.jpg

To resize an image to fit within 500px wide by 300px high, run the following command:

# macOS/Linux
convert picture.jpg -resize 500x300 picture-small.jpg

# Windows
magick convert picture.jpg -resize 500x300 picture-small.jpg

*Note: the recommended number of image sizes is 3-5. Of course the more sizes you create, the better it’s displayed on a device, but this can take up more space on your server.

Use a CDN

A CDN is another way to optimize your images on on-the-fly, without having to tamper with the source images. For Magento, the official recommendation is Fastly as it is tightly integrated with Magento and brings added security benefits, along with full-page caching solutions.

Integrate third-party extensions

Another way to optimize your images is to use a Magento extension. The extension will do the work for you to ensure that your images don’t slow down the page load speed. 

Here are some useful extensions that can be suitable for your Magento store:

Image Optimizer for Magento 2 by Mageplaza

This extension supports store admins to compress various types of images including PNG, JPG, GIF, TIF and BMP and even let you set the compression level. Also, the compression can be activated on a frequent basis, so you don’t have to worry about it.

Lazy Load for Magento 2 by Amasty

With the Lazy Load extension, product information is only filled when a user scrolls down the pages, thus speeding up initial page rendering. It also has extra optimization tools: image compression and code structure optimization to provide the best page performance.

Hope this helps!


by simicart . com

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Meta

Popular Posts

  • Credit card validation in laravel
      Validation rules for credit card using laravel-validation-rules/credit-card package in laravel Install package laravel-validation-rules/cr...
  • iOS 17 Force Screen Rotation not working on iPAD only
    I have followed all the links on Google and StackOverFlow, unfortunately, I could not find any reliable solution Specifically for iPad devic...
  • Write API Integrations in Laravel and PHP Projects with Saloon
    Write API Integrations in Laravel and PHP Projects with Saloon Saloon  is a Laravel/PHP package that allows you to write your API integratio...
  • C++ in Hindi Introduction
    C ++ เค•ा เคชเคฐिเคšเคฏ C ++ เคเค• เค‘เคฌ्เคœेเค•्เคŸ เค“เคฐिเคंเคŸेเคก เคช्เคฐोเค—्เคฐाเคฎिंเค— เคฒैंเค—्เคตेเคœ เคนै। C ++ เค•ो Bjarne Stroustrup เคฆ्เคตाเคฐा เคตिเค•เคธिเคค เค•िเคฏा เค—เคฏा เคฅा। C ++ เคฎें เค†เคจे เคธे เคชเคน...
  • Python AttributeError: 'str' has no attribute glob
    I am trying to look for a folder in a directory but I am getting the error.AttributeError: 'str' has no attribute glob Here's ...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (68)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • July (2)
  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

Loading...

Laravel News

Loading...

Copyright © CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda