Skip to content

Instantly share code, notes, and snippets.

Using nvm-windows
nvm-windows (Node Version Manager for Windows) allows you to install and switch between different versions of Node.js.
reference Link
-https://www.freecodecamp.org/news/nvm-for-windows-how-to-download-and-install-node-version-manager-in-windows-10/
Step-by-Step Instructions:
1. Uninstall Existing Node.js (optional):
If Node.js is already installed, it’s recommended to uninstall it to avoid conflicts.
@Bhavya8181
Bhavya8181 / Add JWT Tymon Auth & Create Login Api Using both Mobile Or Email JWT Authentication
Last active February 13, 2024 06:17
Add JWT Tymon Auth & Create Login Api Using both Mobile Or Email JWT Authentication
Ref Link:
https://jwt-auth.readthedocs.io/en/docs/laravel-installation/
https://medium.com/@online-web-tutor/laravel-10-restful-apis-with-jwt-authentication-tutorial-9f5345e3cce6
Add JWT Auth
======================================================
=> composer require tymon/jwt-auth
=> Add below in your app.php file from /config folder.
'providers' => [
...
function sort_by_value($a, $b) {
return $b['score'] > $a['score'] ? 1 : -1;
}
//sort using usort
usort($events_temp, 'sort_by_value');
----------Edit cron job ---------------------
-> write comman "crontab -e"
-> press "i"
-> go to last cron job.
-> add new cron job
-> press ESC -> press ":wq"
----------- File Permission give ------------
*Give permission to .sh file*
*********
Open file path
--------------------
$myfile = fopen("data/finalized-ids.txt", "a+") or die("Unable to open file!");
Write something into file
--------------
fwrite($myfile, "event_ids,". PHP_EOL);
Clone tables
---------------
CREATE TABLE app_cities_temp LIKE app_cities;
INSERT INTO app_cities_temp SELECT * FROM app_cities;
1 --> create local server using pythin
run this commnad -> python -m SimpleHTTPServer
2 --> then open your server's ip address in browser.
Boom. your server is showing all file using only IP address. Warning - do ctrl + c after work is done. other wise your file publiclly shows on this ip.
// Reset auto increment id
ALTER TABLE tablename AUTO_INCREMENT = 1
// copy new table with indexes (Do not copy data)
CREATE TABLE newtable LIKE oldtable;
@Bhavya8181
Bhavya8181 / PHP File Open - Read - Close
Created February 12, 2024 05:53 — forked from jack2jm/PHP File Open - Read - Close
how to open, read, and close a file on the server.
Modes Description
r -> Open a file for read only. File pointer starts at the beginning of the file
w -> Open a file for write only. Erases the contents of the file or creates a new file if it doesn't exist. File pointer starts at the beginning of the file
a -> Open a file for write only. The existing data in file is preserved. File pointer starts at the end of the file. Creates a new file if the file doesn't exist
x -> Creates a new file for write only. Returns FALSE and an error if file already exists
r+ -> Open a file for read/write. File pointer starts at the beginning of the file
w+ -> Open a file for read/write. Erases the contents of the file or creates a new file if it doesn't exist. File pointer starts at the beginning of the file
a+ -> Open a file for read/write. The existing data in file is preserved. File pointer starts at the end of the file. Creates a new file if the file doesn't exist
x+ -> Creates a new file for read/write. Returns FALSE and an error if file already exists
Here is my learning from laravel things.
1. Homepage -> Route.php -> Controller -> Fetch Neccessory Information Database -> Eloquont Model -> Get Reposne -> COntroller -> Show Data.