I get it, a lot of people are confused on how to start typing on VIM. All you have to do is press the A
key, the editor will be switched to insert mode.
Press ESC
key to switch back to normal mode.
I get it, a lot of people are confused on how to start typing on VIM. All you have to do is press the A
key, the editor will be switched to insert mode.
Press ESC
key to switch back to normal mode.
Type the following command to view available memory in your system:
free -h
Type the following command to view available disk space in your system:
df -h
If you're hosting a laravel project via cPanel, chances are that it could be a shared hosting server and that means you can't really use php artisan storage:link
for this.
But don't worry, there's another way to this. Just follow the steps below:
In your public_html/public
directory, remove the storage
folder. Next, create a symlink.php
file in your public_html
directory and add the following code:
<?php
$targetFolder = $_SERVER['DOCUMENT_ROOT'].'/storage/app/public';
$linkedFolder = $_SERVER['DOCUMENT_ROOT'].'/public/storage';
symlink($targetFolder, $linkedFolder);
echo "done";
?>
Alright, this is kind of a hack but it works extremely fine. Just add the following route in your routes/web.php
file:
<?php
Route::get('/storage/anyfolder/{filename}', function($filename){
// Your folder path
$folder_path = storage_path('app/public/anyfolder/'.$filename);
// check if the file exists
if(!File::exists($folder_path)) {
abort(404);
}
$file = File::get($folder_path);
$type = File::mimeType($folder_path);
$response = Response::make($file, 200);
$response->header("Content-Type", $type);
return $response;
})
?>
Now, you can access your images or any other assets easily using:
<?php
asset('storage/anyfolder/'.$filename)
?>
Hope this helps you out!
Before you integrate Excel into your application, make sure your project meets the following requirements:
Download the maatwebsite/excel
package using Composer:
composer require maatwebsite/excel
By default, this will be done automatically when you're installing the package but if you want to do it yourself, add this in your config/app.php
file:
<?php
// ...
'providers' => [
// ...
Maatwebsite\Excel\ExcelServiceProvider::class,
],
// ...
'aliases' => [
// ...
'Excel' => 'Maatwebsite\Excel\Facades\Excel::class',
],
?>;
Last but not the least, run the vendor:publish
command using artisan
to publish your configuration:
php artisan vendor:publish -provider="Maatwebsite\Excel\ExcelServiceProvider"
Upon publishing, the config/excel.php
configuration file will be created where you can make your changes.
Hope this helps you out!
This comes in handy if you're using the terminal in full screen but still want to know your battery life. Just type the following:
upower -i /org/freedesktop/UPower/devices/battery_BAT0
Are you new to using Git? Then this is for you.
Go to GitHub and create your account with your email address.
Just create a new project with whatever you wanted. For this, you can just create git-starter-repo
or something like that.
Now, go to your project directory and initialize git by doing the following:
git init
Add your files to the repository by doing the following:
git add .
Or if you want add selected files:
git add file_1 file_2
Before you push your changes, you need to write a message about what changes are done:
git commit -m "this is my first commit"
Do the following to link your project to the repo that you've created in step 1:
git remote add origin https://github.com/youraccount/repositoryname.git
You can decide which branch you wanted to push but initially, you'll have one branch, which is called master
:
git push -u origin master
Or if you have an existing branch, just replace master
with yourbranchname
.
Hope that helps you out!
Want to create a new branch in your project? Simple, just do this:
git checkout -b new_branch
By doing this, you'll automatically be shifted to a new branch of your project. To check which branch you're working on, type this:
git branch
And you should be able to see your current branch marked with a *
:
master
* new_branch
I'm challenging myself to write a book on how to build simple applications using ReactJS
Over the past few months, I've been spending some of my free time to learn ReactJS and I've got to say, I really like it and got a hang of it after lots of trials and errors.
Just to make it clear, I didn't become a ReactJS expert or something but I figured that writing a book on something that you've learnt would help you understand the material much more deeper.
And since I do believe in it, I decided to challenge myself to write a book on it.
I aim to cover the fundamentals and concepts of ReactJS using a progressive and an example-driven approach. You know like on how to write reusable UI components, handle user events and interactions and managing state and props of a component.
By the end of this book, the reader will have solid understanding of React's concepts and be able to build cool applications using it.
Honestly, I didn't plan on the size of the book yet but the practical content for it i.e. the actual code and applications are ready. I aim to release it somewhere around late April 2020.
Umm, nope! I believe that knowledge should be accessible for everyone and I plan on making the book open source, so that it can get updated as per the latest changes.
I know it's a short article but I feel like I wanted to challenge myself with a small goal for this year.
Let's see how it goes!