mirror of
https://github.com/LeCoupa/awesome-cheatsheets.git
synced 2026-01-29 22:58:04 -08:00
Compare commits
1 Commits
master
...
d99a8d9fe2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d99a8d9fe2 |
@@ -124,7 +124,6 @@ Feel free to take a look. You might learn new things. They have been designed to
|
|||||||
- [Nginx](tools/nginx.sh)
|
- [Nginx](tools/nginx.sh)
|
||||||
- [PM2](tools/pm2.sh)
|
- [PM2](tools/pm2.sh)
|
||||||
- [Ubuntu](tools/ubuntu.sh)
|
- [Ubuntu](tools/ubuntu.sh)
|
||||||
- [Firebase CLI](tools/firebase_cli.md)
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## 🙌🏼 How to Contribute?
|
## 🙌🏼 How to Contribute?
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
// MAIN.
|
// MAIN.
|
||||||
|
|
||||||
php artisan clear-compiled // Remove the compiled class file
|
php artisan clear-compiled // Remove the compiled class file
|
||||||
php artisan db // Start a new database CLI session
|
|
||||||
php artisan docs // Access the Laravel documentation
|
|
||||||
php artisan down // Put the application into maintenance mode
|
php artisan down // Put the application into maintenance mode
|
||||||
php artisan dump-server // Start the dump server to collect dump information.
|
php artisan dump-server // Start the dump server to collect dump information.
|
||||||
php artisan env // Display the current framework environment
|
php artisan env // Display the current framework environment
|
||||||
@@ -45,9 +43,6 @@ php artisan config:clear // Remove the configuration cache file
|
|||||||
// DB
|
// DB
|
||||||
|
|
||||||
php artisan db:seed // Seed the database with records
|
php artisan db:seed // Seed the database with records
|
||||||
php artisan db:show // Display information about the given database
|
|
||||||
php artisan db:table // Display information about the given database table
|
|
||||||
php artisan db:wipe // Drop all tables, views, and types
|
|
||||||
|
|
||||||
// EVENT
|
// EVENT
|
||||||
|
|
||||||
@@ -59,10 +54,9 @@ php artisan key:generate // Set the application key
|
|||||||
|
|
||||||
// MAKE
|
// MAKE
|
||||||
|
|
||||||
php artisan make:cast // Create a new custom Eloquent cast class
|
php artisan make:auth // Scaffold basic login and registration views and routes
|
||||||
php artisan make:channel // Create a new channel class
|
php artisan make:channel // Create a new channel class
|
||||||
php artisan make:command // Create a new Artisan command
|
php artisan make:command // Create a new Artisan command
|
||||||
php artisan make:component // Create a new view component class
|
|
||||||
php artisan make:controller // Create a new controller class
|
php artisan make:controller // Create a new controller class
|
||||||
php artisan make:event // Create a new event class
|
php artisan make:event // Create a new event class
|
||||||
php artisan make:exception // Create a new custom exception class
|
php artisan make:exception // Create a new custom exception class
|
||||||
@@ -80,7 +74,6 @@ php artisan make:provider // Create a new service provider class
|
|||||||
php artisan make:request // Create a new form request class
|
php artisan make:request // Create a new form request class
|
||||||
php artisan make:resource // Create a new resource
|
php artisan make:resource // Create a new resource
|
||||||
php artisan make:rule // Create a new validation rule
|
php artisan make:rule // Create a new validation rule
|
||||||
php artisan make:scope // Create a new scope class
|
|
||||||
php artisan make:seeder // Create a new seeder class
|
php artisan make:seeder // Create a new seeder class
|
||||||
php artisan make:test // Create a new test class
|
php artisan make:test // Create a new test class
|
||||||
|
|
||||||
@@ -93,10 +86,6 @@ php artisan migrate:reset // Rollback all database migrations
|
|||||||
php artisan migrate:rollback // Rollback the last database migration
|
php artisan migrate:rollback // Rollback the last database migration
|
||||||
php artisan migrate:status // Show the status of each migration
|
php artisan migrate:status // Show the status of each migration
|
||||||
|
|
||||||
// MODEL
|
|
||||||
php artisan model:prune // Prune models that are no longer needed
|
|
||||||
php artisan model:show // Show information about an Eloquent model
|
|
||||||
|
|
||||||
// NOTIFICATIONS
|
// NOTIFICATIONS
|
||||||
|
|
||||||
php artisan notifications:table // Create a migration for the notifications table
|
php artisan notifications:table // Create a migration for the notifications table
|
||||||
@@ -111,19 +100,13 @@ php artisan package:discover // Rebuild the cached package manifest
|
|||||||
|
|
||||||
// QUEUE
|
// QUEUE
|
||||||
|
|
||||||
php artisan queue:batches-table // Create a migration for the batches database table
|
|
||||||
php artisan queue:clear // Delete all of the jobs from the specified queue
|
|
||||||
php artisan queue:failed // List all of the failed queue jobs
|
php artisan queue:failed // List all of the failed queue jobs
|
||||||
php artisan queue:failed-table // Create a migration for the failed queue jobs database table
|
php artisan queue:failed-table // Create a migration for the failed queue jobs database table
|
||||||
php artisan queue:flush // Flush all of the failed queue jobs
|
php artisan queue:flush // Flush all of the failed queue jobs
|
||||||
php artisan queue:forget // Delete a failed queue job
|
php artisan queue:forget // Delete a failed queue job
|
||||||
php artisan queue:listen // Listen to a given queue
|
php artisan queue:listen // Listen to a given queue
|
||||||
php artisan queue:monitor // Monitor the size of the specified queues
|
|
||||||
php artisan queue:prune-batches // Prune stale entries from the batches database
|
|
||||||
php artisan queue:prune-failed // Prune stale entries from the failed jobs table
|
|
||||||
php artisan queue:restart // Restart queue worker daemons after their current job
|
php artisan queue:restart // Restart queue worker daemons after their current job
|
||||||
php artisan queue:retry // Retry a failed queue job
|
php artisan queue:retry // Retry a failed queue job
|
||||||
php artisan queue:retry-batch // Retry the failed jobs for a batch
|
|
||||||
php artisan queue:table // Create a migration for the queue jobs database table
|
php artisan queue:table // Create a migration for the queue jobs database table
|
||||||
php artisan queue:work // Start processing jobs on the queue as a daemon
|
php artisan queue:work // Start processing jobs on the queue as a daemon
|
||||||
|
|
||||||
@@ -133,26 +116,9 @@ php artisan route:cache // Create a route cache file for faster route r
|
|||||||
php artisan route:clear // Remove the route cache file
|
php artisan route:clear // Remove the route cache file
|
||||||
php artisan route:list // List all registered routes
|
php artisan route:list // List all registered routes
|
||||||
|
|
||||||
// SAIL
|
|
||||||
|
|
||||||
php artisan sail:install // Install Laravel Sail's default Docker Compose file
|
|
||||||
php artisan sail:publish // Publish the Laravel Sail Docker files
|
|
||||||
|
|
||||||
// SANCTUM
|
|
||||||
|
|
||||||
php artisan sanctum:prune-expired // Prune tokens expired for more than specified number of hours.
|
|
||||||
|
|
||||||
// SCHEDULE
|
// SCHEDULE
|
||||||
|
|
||||||
php artisan schedule:clear-cache // Delete the cached mutex files created by scheduler
|
|
||||||
php artisan schedule:list // List the scheduled commands
|
|
||||||
php artisan schedule:run // Run the scheduled commands
|
php artisan schedule:run // Run the scheduled commands
|
||||||
php artisan schedule:test // Run a scheduled command
|
|
||||||
php artisan schedule:work // Start the schedule worker
|
|
||||||
|
|
||||||
// SCHEMA
|
|
||||||
|
|
||||||
php artisan schema:dump // Dump the given database schema
|
|
||||||
|
|
||||||
// SESSION
|
// SESSION
|
||||||
|
|
||||||
@@ -162,10 +128,6 @@ php artisan session:table // Create a migration for the session database
|
|||||||
|
|
||||||
php artisan storage:link // Create a symbolic link from "public/storage" to "storage/app/public"
|
php artisan storage:link // Create a symbolic link from "public/storage" to "storage/app/public"
|
||||||
|
|
||||||
// STUD
|
|
||||||
|
|
||||||
php artisan stub:publish // Publish all stubs that are available for customization
|
|
||||||
|
|
||||||
// VENDOR
|
// VENDOR
|
||||||
|
|
||||||
php artisan vendor:publish // Publish any publishable assets from vendor packages
|
php artisan vendor:publish // Publish any publishable assets from vendor packages
|
||||||
|
|||||||
@@ -16,69 +16,3 @@ GRANT ALL PRIVILEGES ON prospectwith.* TO 'power'@'localhost' WITH GRANT OPTION;
|
|||||||
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; # Create user
|
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; # Create user
|
||||||
|
|
||||||
mysql -u root -pmypassword -e "MY SQL QUERY" &>> query.log & disown # Run SQL query in the background
|
mysql -u root -pmypassword -e "MY SQL QUERY" &>> query.log & disown # Run SQL query in the background
|
||||||
|
|
||||||
# *****************************************************************************
|
|
||||||
# Database and Table Operations
|
|
||||||
# *****************************************************************************
|
|
||||||
|
|
||||||
CREATE DATABASE database_name; # Create a new database
|
|
||||||
DROP DATABASE database_name; # Delete a database
|
|
||||||
CREATE TABLE table_name (column1 datatype, column2 datatype, ...); # Create a new table
|
|
||||||
DROP TABLE table_name; # Delete a table
|
|
||||||
SHOW TABLES; # Display all tables in the current database
|
|
||||||
DESCRIBE table_name; # Show the structure of a table
|
|
||||||
|
|
||||||
# *****************************************************************************
|
|
||||||
# Data Manipulation
|
|
||||||
# *****************************************************************************
|
|
||||||
|
|
||||||
INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...); # Insert data into a table
|
|
||||||
UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition; # Update existing data in a table
|
|
||||||
DELETE FROM table_name WHERE condition; # Delete data from a table
|
|
||||||
SELECT column1, column2, ... FROM table_name WHERE condition; # Select data from a table
|
|
||||||
|
|
||||||
# *****************************************************************************
|
|
||||||
# Backup and Restore
|
|
||||||
# *****************************************************************************
|
|
||||||
|
|
||||||
mysqldump -u username -p database_name table1 table2 > file.sql # Backup specific tables
|
|
||||||
mysql -u username -p database_name < file.sql # Restore specific tables
|
|
||||||
|
|
||||||
# *****************************************************************************
|
|
||||||
# User Management and Security
|
|
||||||
# *****************************************************************************
|
|
||||||
|
|
||||||
REVOKE privilege_type ON database_name.table_name FROM 'username'@'hostname'; # Revoke privileges from a user
|
|
||||||
DROP USER 'username'@'hostname'; # Delete a user
|
|
||||||
ALTER USER 'username'@'hostname' IDENTIFIED BY 'newpassword'; # Reset a user's password
|
|
||||||
|
|
||||||
# *****************************************************************************
|
|
||||||
# Performance and Maintenance
|
|
||||||
# *****************************************************************************
|
|
||||||
|
|
||||||
OPTIMIZE TABLE table_name; # Optimize a table
|
|
||||||
ANALYZE TABLE table_name; # Analyze a table for key distribution and storage optimization
|
|
||||||
CHECK TABLE table_name; # Check a table for errors
|
|
||||||
REPAIR TABLE table_name; # Repair a corrupted table
|
|
||||||
|
|
||||||
# *****************************************************************************
|
|
||||||
# Advanced Queries
|
|
||||||
# *****************************************************************************
|
|
||||||
|
|
||||||
SELECT ... FROM table1 JOIN table2 ON table1.column = table2.column; # Perform a join operation between two tables
|
|
||||||
SELECT ... FROM (SELECT ... FROM table_name) AS subquery; # Use a subquery within another query
|
|
||||||
SELECT column, COUNT(*) FROM table_name GROUP BY column; # Group results and use aggregate functions
|
|
||||||
|
|
||||||
# *****************************************************************************
|
|
||||||
# System Information
|
|
||||||
# *****************************************************************************
|
|
||||||
|
|
||||||
SELECT VERSION(); # Show the current version of MySQL
|
|
||||||
SELECT User, Host FROM mysql.user; # List all current MySQL users
|
|
||||||
|
|
||||||
# *****************************************************************************
|
|
||||||
# Miscellaneous
|
|
||||||
# *****************************************************************************
|
|
||||||
|
|
||||||
SET GLOBAL general_log = 'ON'; # Enable query logging
|
|
||||||
SHOW FULL PROCESSLIST; # Show the last queries executed in MySQL
|
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ width="" <!-- Describes the width of th
|
|||||||
<!-- Some other useful tags -->
|
<!-- Some other useful tags -->
|
||||||
|
|
||||||
<canvas></canvas> <!-- Allows to draw 2D shapes on the web page with the help of javascript -->
|
<canvas></canvas> <!-- Allows to draw 2D shapes on the web page with the help of javascript -->
|
||||||
|
<keygen> <!-- Represents a control for generating a public-private key pair -->
|
||||||
<map></map> <!-- Specifies an image map -->
|
<map></map> <!-- Specifies an image map -->
|
||||||
|
|
||||||
<!-- Collective Character Obejcts -->
|
<!-- Collective Character Obejcts -->
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ CHEATSHEET C#
|
|||||||
string newStr = oldStr.Replace("old","new");
|
string newStr = oldStr.Replace("old","new");
|
||||||
|
|
||||||
//IndexOf
|
//IndexOf
|
||||||
//Finds the first occurrence of a string in a larger string
|
//Finds the first ocurrence of a string in a larger string
|
||||||
//Returns -1 if the string is not found
|
//Returns -1 if the string is not found
|
||||||
String.IndexOf(val, start, num)
|
String.IndexOf(val, start, num)
|
||||||
val - string to search for
|
val - string to search for
|
||||||
@@ -102,7 +102,7 @@ CHEATSHEET C#
|
|||||||
String.Split(Char[]);
|
String.Split(Char[]);
|
||||||
|
|
||||||
//ToCharArray
|
//ToCharArray
|
||||||
//Places selected characters in a string in a char array
|
//Places selected characteres in a string in a char array
|
||||||
String str = "AaBbCcDd";
|
String str = "AaBbCcDd";
|
||||||
//create array of 8 vowels
|
//create array of 8 vowels
|
||||||
var chars = str.ToCharArray();
|
var chars = str.ToCharArray();
|
||||||
@@ -135,7 +135,7 @@ CHEATSHEET C#
|
|||||||
|
|
||||||
6.1 TimeSpan Constructor
|
6.1 TimeSpan Constructor
|
||||||
|
|
||||||
TimeSpan(hour, minute, sec)
|
TimpeSpan(hour, minute, sec)
|
||||||
|
|
||||||
TimeSpan timeS = new TimeSpan(10, 14, 50);
|
TimeSpan timeS = new TimeSpan(10, 14, 50);
|
||||||
TimeSpan timeS_Hours = TimeSpan.FromDays(3640);
|
TimeSpan timeS_Hours = TimeSpan.FromDays(3640);
|
||||||
@@ -144,8 +144,8 @@ CHEATSHEET C#
|
|||||||
|
|
||||||
Format item syntax: {index[,alignment][:format string]}
|
Format item syntax: {index[,alignment][:format string]}
|
||||||
index - Specifies element in list of values to which format is applied
|
index - Specifies element in list of values to which format is applied
|
||||||
alignment - Indicates minimum width (in characters) to display value
|
aligment - Indicates minimun width (in characters) to display value
|
||||||
format string - Contains the code which specifies the format of the displayed value
|
format string - Contains the code which specififes the format of the displayed value
|
||||||
|
|
||||||
7.1 Numeric
|
7.1 Numeric
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ CHEATSHEET C#
|
|||||||
[access modifier] className (parameters) [:initializer]
|
[access modifier] className (parameters) [:initializer]
|
||||||
|
|
||||||
initializer -base calls constructor in base class.
|
initializer -base calls constructor in base class.
|
||||||
this calls constructor within class.
|
this calls constuctor within class.
|
||||||
|
|
||||||
public class nameClass : Initializer {
|
public class nameClass : Initializer {
|
||||||
public className(dataType param1 , dataType param2, ...) : base(param1, param2)
|
public className(dataType param1 , dataType param2, ...) : base(param1, param2)
|
||||||
@@ -313,8 +313,8 @@ CHEATSHEET C#
|
|||||||
abstract – must be implemented by subclass
|
abstract – must be implemented by subclass
|
||||||
|
|
||||||
Passing parameters:
|
Passing parameters:
|
||||||
1. By default, parameters are passed by value
|
1. By default, parametres are passed by value
|
||||||
2. Passing by reference: ref, in and out modifiers
|
2. Passing by reference: ref, in and out modifers
|
||||||
|
|
||||||
To pass a parameter by reference with the intent of changing the value, use the ref, or out keyword. To pass by reference with the intent of avoiding copying but not changing the value, use the in modifier
|
To pass a parameter by reference with the intent of changing the value, use the ref, or out keyword. To pass by reference with the intent of avoiding copying but not changing the value, use the in modifier
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,6 @@ Operators
|
|||||||
^= bitwise exclusive or and store
|
^= bitwise exclusive or and store
|
||||||
|= bitwise or and store
|
|= bitwise or and store
|
||||||
, separator as in ( y=x,z=++x )
|
, separator as in ( y=x,z=++x )
|
||||||
; statement terminator.
|
|
||||||
|
|
||||||
|
|
||||||
Operator precedence
|
Operator precedence
|
||||||
|
|||||||
@@ -524,14 +524,14 @@ Cyan='\033[0;36m' # Cyan
|
|||||||
White='\033[0;97m' # White
|
White='\033[0;97m' # White
|
||||||
|
|
||||||
# Additional colors
|
# Additional colors
|
||||||
LGrey='\033[0;37m' # Light Gray
|
LGrey='\033[0;37m' # Ligth Gray
|
||||||
DGrey='\033[0;90m' # Dark Gray
|
DGrey='\033[0;90m' # Dark Gray
|
||||||
LRed='\033[0;91m' # Light Red
|
LRed='\033[0;91m' # Ligth Red
|
||||||
LGreen='\033[0;92m' # Light Green
|
LGreen='\033[0;92m' # Ligth Green
|
||||||
LYellow='\033[0;93m'# Light Yellow
|
LYellow='\033[0;93m'# Ligth Yellow
|
||||||
LBlue='\033[0;94m' # Light Blue
|
LBlue='\033[0;94m' # Ligth Blue
|
||||||
LPurple='\033[0;95m'# Light Purple
|
LPurple='\033[0;95m'# Light Purple
|
||||||
LCyan='\033[0;96m' # Light Cyan
|
LCyan='\033[0;96m' # Ligth Cyan
|
||||||
|
|
||||||
|
|
||||||
# Bold
|
# Bold
|
||||||
|
|||||||
@@ -397,8 +397,8 @@ d, t := doubleAndTriple(5)
|
|||||||
_, t := doubleAndTriple(3)
|
_, t := doubleAndTriple(3)
|
||||||
// t = 9
|
// t = 9
|
||||||
|
|
||||||
// Functions can defer commands. Deferred commands are
|
// Functions can defer commands. Defered commands are
|
||||||
// ran in a stack order after the execution and
|
// runned in a stack order after the execution and
|
||||||
// returning of a function
|
// returning of a function
|
||||||
var aux = 0
|
var aux = 0
|
||||||
|
|
||||||
@@ -488,7 +488,7 @@ person3.Age // 0
|
|||||||
|
|
||||||
## Maps
|
## Maps
|
||||||
|
|
||||||
Maps are data structures that holds values assigned to a key.
|
Maps are data structures that holds values assigneds to a key.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// Declaring a map
|
// Declaring a map
|
||||||
@@ -508,7 +508,7 @@ newYork // "EUA"
|
|||||||
// Delete
|
// Delete
|
||||||
delete(cities, "NY")
|
delete(cities, "NY")
|
||||||
|
|
||||||
// Check if a key is set
|
// Check if a key is setted
|
||||||
value, ok := cities["NY"]
|
value, ok := cities["NY"]
|
||||||
ok // false
|
ok // false
|
||||||
value // ""
|
value // ""
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ for(dataType item : array) {
|
|||||||
|
|
||||||
### ACCESS MODIFIERS
|
### ACCESS MODIFIERS
|
||||||
|
|
||||||
1. default(No keyword required)
|
1. defualt(No keyword required)
|
||||||
2. private
|
2. private
|
||||||
3. public
|
3. public
|
||||||
4. protected
|
4. protected
|
||||||
@@ -308,7 +308,7 @@ for(dataType item : array) {
|
|||||||
//Declare a variable, object name
|
//Declare a variable, object name
|
||||||
String s;
|
String s;
|
||||||
|
|
||||||
//Invoke a constructor to create an object
|
//Invoke a contructor to create an object
|
||||||
s = new String ("Hello World");
|
s = new String ("Hello World");
|
||||||
|
|
||||||
//Invoke an instance method that operates on the object's value
|
//Invoke an instance method that operates on the object's value
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ array.splice(start, deleteCount, item1, item2, ...) // Adds and/or removes elem
|
|||||||
arr.unshift([element1[, ...[, elementN]]]) // Adds one or more elements to the front of an array and returns the new length of the array.
|
arr.unshift([element1[, ...[, elementN]]]) // Adds one or more elements to the front of an array and returns the new length of the array.
|
||||||
|
|
||||||
// Instance: accessor methods
|
// Instance: accessor methods
|
||||||
arr.at(index) // Returns the element at the specified index in the array.
|
|
||||||
arr.concat(value1[, value2[, ...[, valueN]]]) // Returns a new array comprised of this array joined with other array(s) and/or value(s).
|
arr.concat(value1[, value2[, ...[, valueN]]]) // Returns a new array comprised of this array joined with other array(s) and/or value(s).
|
||||||
arr.includes(searchElement, fromIndex) // Determines whether an array contains a certain element, returning true or false as appropriate.
|
arr.includes(searchElement, fromIndex) // Determines whether an array contains a certain element, returning true or false as appropriate.
|
||||||
arr.indexOf(searchElement[, fromIndex]) // Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
|
arr.indexOf(searchElement[, fromIndex]) // Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found.
|
||||||
@@ -95,9 +94,3 @@ arr.reduce(callback[, initialValue]) // Apply a function against
|
|||||||
arr.reduceRight(callback[, initialValue]) // Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value.
|
arr.reduceRight(callback[, initialValue]) // Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value.
|
||||||
arr.some(callback[, initialValue]) // Returns true if at least one element in this array satisfies the provided testing function.
|
arr.some(callback[, initialValue]) // Returns true if at least one element in this array satisfies the provided testing function.
|
||||||
arr.values() // Returns a new Array Iterator object that contains the values for each index in the array.
|
arr.values() // Returns a new Array Iterator object that contains the values for each index in the array.
|
||||||
|
|
||||||
// String methods
|
|
||||||
String.charAt(index) // Returns the character at the specified index in a string.
|
|
||||||
String.indexOf(character) // Returns the index of the first occurrence of a specified value in a string.
|
|
||||||
String.substring(starting_index, ending_index) // Returns a new string that is a subset of the original string.
|
|
||||||
String.substring(starting_index) // Returns a substring from starting index to last index of string.
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Exit the file, string inside get's echo'ed
|
// Exit the file, string inside get's echo'ed
|
||||||
die("This file is not meant to be ran. ¯\_(ツ)_/¯");
|
die("This file is not ment to be ran. ¯\_(ツ)_/¯");
|
||||||
exit("This file is not meant to be ran. ¯\_(ツ)_/¯");
|
exit("This file is not ment to be ran. ¯\_(ツ)_/¯");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Printing
|
* Printing
|
||||||
@@ -17,7 +17,7 @@ var_dump($arr); // Print anything, with type hints for any value and sizes
|
|||||||
$string = 'Awesome cheatsheets';
|
$string = 'Awesome cheatsheets';
|
||||||
|
|
||||||
str_contains($string, 'cheat'); // Find if the string contains the specified string (PHP >= 8.0)
|
str_contains($string, 'cheat'); // Find if the string contains the specified string (PHP >= 8.0)
|
||||||
str_replace('Awesome', 'Bonjour', $string); // Replace all occurrence
|
str_replace('Awesome', 'Bonjour', $string); // Replace all occurence
|
||||||
strcmp($string, 'Awesome cheatsheets'); // Compare two strings
|
strcmp($string, 'Awesome cheatsheets'); // Compare two strings
|
||||||
strpos($string, 'a', 0); // Get position in the string
|
strpos($string, 'a', 0); // Get position in the string
|
||||||
str_split($string, 2); // Split the string
|
str_split($string, 2); // Split the string
|
||||||
@@ -541,7 +541,7 @@ u Pattern is treated as UTF-8
|
|||||||
\w Any "word" character (a-z 0-9 _)
|
\w Any "word" character (a-z 0-9 _)
|
||||||
\W Any non "word" character
|
\W Any non "word" character
|
||||||
\s Whitespace (space, tab CRLF)
|
\s Whitespace (space, tab CRLF)
|
||||||
\S Any non whitespace character
|
\S Any non whitepsace character
|
||||||
\d Digits (0-9)
|
\d Digits (0-9)
|
||||||
\D Any non digit character
|
\D Any non digit character
|
||||||
. (Period) - Any character except newline
|
. (Period) - Any character except newline
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
| import | import libraries/modules/packages | import |
|
| import | import libraries/modules/packages | import |
|
||||||
| from | import specific function/classes from modules/packages | import |
|
| from | import specific function/classes from modules/packages | import |
|
||||||
| try | this block will be tried to get executed | exception handling |
|
| try | this block will be tried to get executed | exception handling |
|
||||||
| except | is any exception/error has occurred it'll be executed | exception handling |
|
| except | is any exception/error has occured it'll be executed | exception handling |
|
||||||
| finally | It'll be executed no matter exception occurs or not | exception handling |
|
| finally | It'll be executed no matter exception occurs or not | exception handling |
|
||||||
| raise | throws any specific error/exception | exception handling |
|
| raise | throws any specific error/exception | exception handling |
|
||||||
| assert | throws an AssertionError if condition is false | exception handling |
|
| assert | throws an AssertionError if condition is false | exception handling |
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# DOCKER
|
# DOCKER
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
docker init # Creates Docker-related starter files
|
|
||||||
docker build -t friendlyname . # Create image using this directory's Dockerfile
|
docker build -t friendlyname . # Create image using this directory's Dockerfile
|
||||||
docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to 80
|
docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to 80
|
||||||
docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode
|
docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode
|
||||||
|
|||||||
@@ -1,140 +0,0 @@
|
|||||||
# Firebase CLI Guide
|
|
||||||
|
|
||||||
Firebase CLI (Command Line Interface) is a powerful tool that allows developers to interact with Firebase services and manage their Firebase projects directly from the command line. It provides a convenient and efficient way to deploy projects, manage databases, configure authentication, and more, streamlining the development and deployment processes.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
To use the Firebase CLI, you need to have Node.js and npm (Node Package Manager) installed on your system. Follow the steps below to install the Firebase CLI:
|
|
||||||
|
|
||||||
1. Install Node.js and npm by downloading the installer from the [official Node.js website](https://nodejs.org/en/download/) and following the installation instructions for your operating system.
|
|
||||||
|
|
||||||
2. Once Node.js and npm are installed, open your terminal or command prompt and run the following command to install the Firebase CLI globally:
|
|
||||||
|
|
||||||
```
|
|
||||||
npm install -g firebase-tools
|
|
||||||
```
|
|
||||||
|
|
||||||
This command will download and install the Firebase CLI package from the npm registry.
|
|
||||||
|
|
||||||
3. After the installation is complete, you can verify that the Firebase CLI is installed correctly by running the following command:
|
|
||||||
|
|
||||||
```
|
|
||||||
firebase --version
|
|
||||||
```
|
|
||||||
|
|
||||||
If the installation was successful, you will see the version number of the Firebase CLI printed in the terminal.
|
|
||||||
|
|
||||||
Congratulations! You have successfully installed the Firebase CLI.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
The Firebase CLI allows you to interact with Firebase services and manage your Firebase projects from the command line. Here are some common tasks you can perform using the Firebase CLI:
|
|
||||||
|
|
||||||
- Initialize a new Firebase project in your current directory.
|
|
||||||
- Deploy your Firebase project to Firebase hosting.
|
|
||||||
- Manage Firebase Authentication, Realtime Database, Cloud Firestore, Cloud Functions, and other Firebase services.
|
|
||||||
- Configure Firebase project settings.
|
|
||||||
- Interact with Firebase emulators for local development and testing.
|
|
||||||
|
|
||||||
To use the Firebase CLI, open your terminal or command prompt and run the `firebase` command followed by the desired command and options.
|
|
||||||
|
|
||||||
Here's an example of the basic usage:
|
|
||||||
|
|
||||||
```
|
|
||||||
firebase <command> [options]
|
|
||||||
```
|
|
||||||
|
|
||||||
Replace `<command>` with the specific Firebase command you want to execute, and `[options]` with any additional options or flags required for that command.
|
|
||||||
|
|
||||||
For more detailed usage information, you can run the following command:
|
|
||||||
|
|
||||||
```
|
|
||||||
firebase help
|
|
||||||
```
|
|
||||||
|
|
||||||
This command will display the available Firebase commands and provide detailed information about each command.
|
|
||||||
|
|
||||||
## Commands
|
|
||||||
|
|
||||||
Here are the commonly used Firebase CLI commands along with a brief explanation, syntax, and an example for each command:
|
|
||||||
|
|
||||||
- `firebase init`: Initializes a new Firebase project in the current directory.
|
|
||||||
|
|
||||||
- Syntax: `firebase init [options]`
|
|
||||||
- Example: `firebase init hosting` initializes Firebase Hosting for the current project.
|
|
||||||
|
|
||||||
- `firebase deploy`: Deploys your Firebase project to Firebase hosting or other Firebase services.
|
|
||||||
|
|
||||||
- Syntax: `firebase deploy [options]`
|
|
||||||
- Example: `firebase deploy --only hosting` deploys only the Firebase Hosting content.
|
|
||||||
|
|
||||||
- `firebase serve`: Starts local development servers and Firebase emulators.
|
|
||||||
|
|
||||||
- Syntax: `firebase serve [options]`
|
|
||||||
- Example: `firebase serve --only functions,hosting` starts the Firebase emulators for functions and hosting.
|
|
||||||
|
|
||||||
- `firebase login`: Authenticates the Firebase CLI with your Firebase account.
|
|
||||||
|
|
||||||
- Syntax: `firebase login [options]`
|
|
||||||
- Example: `firebase login --no-localhost` initiates an interactive login session without connecting to localhost.
|
|
||||||
|
|
||||||
- `firebase logout`: Logs out from the Firebase CLI.
|
|
||||||
|
|
||||||
- Syntax: `firebase logout [options]`
|
|
||||||
- Example: `firebase logout` logs out the currently authenticated user.
|
|
||||||
|
|
||||||
- `firebase use`: Sets the active Firebase project for the current directory.
|
|
||||||
|
|
||||||
- Syntax: `firebase use <project_id> [options]`
|
|
||||||
- Example: `firebase use my-project` sets "my-project" as the active Firebase project.
|
|
||||||
|
|
||||||
- `firebase functions`: Interacts with Firebase Cloud Functions.
|
|
||||||
|
|
||||||
- Syntax: `firebase functions:command [options]`
|
|
||||||
- Example: `firebase functions:delete [function_name]` deletes all functions that match the specified name in all regions.
|
|
||||||
|
|
||||||
- `firebase database`: Interacts with Firebase Realtime Database.
|
|
||||||
|
|
||||||
- Syntax: `firebase database:command [options]`
|
|
||||||
- Example: `firebase database:get /users` retrieves data from the Firebase Realtime Database.
|
|
||||||
|
|
||||||
- `firebase firestore`: Interacts with Firebase Cloud Firestore.
|
|
||||||
|
|
||||||
- Syntax: `firebase firestore:command [options]`
|
|
||||||
- Example: `firebase firestore:delete collection/document` deletes a document from the Firestore database.
|
|
||||||
|
|
||||||
- `firebase auth`: Interacts with Firebase Authentication.
|
|
||||||
|
|
||||||
- Syntax: `firebase auth:command [options]`
|
|
||||||
- Example: `firebase auth:export users.csv` exports user data to a CSV file.
|
|
||||||
|
|
||||||
- `firebase hosting`: Interacts with Firebase Hosting.
|
|
||||||
|
|
||||||
- Syntax: `firebase hosting:command [options]`
|
|
||||||
- Example: `firebase hosting:disable` disables Firebase Hosting for the current project.
|
|
||||||
|
|
||||||
- `firebase remoteconfig`: Interacts with Firebase Remote Config.
|
|
||||||
|
|
||||||
- Syntax: `firebase remoteconfig:command [options]`
|
|
||||||
- Example: `firebase remoteconfig:get template` retrieves the Remote Config template.
|
|
||||||
|
|
||||||
- `firebase ext`: Interacts with Firebase Extensions.
|
|
||||||
|
|
||||||
- Syntax: `firebase ext:command [options]`
|
|
||||||
- Example: `firebase ext:install firebase/delete-user-data` installs the Firebase Extension named "firebase/delete-user-data".
|
|
||||||
|
|
||||||
- `firebase appdistribution`: Interacts with Firebase App Distribution.
|
|
||||||
|
|
||||||
- Syntax: `firebase appdistribution:command [options]`
|
|
||||||
- Example: `firebase appdistribution:testers:add` Adds testers to the project.
|
|
||||||
|
|
||||||
- `firebase use --add`: Adds an existing Firebase project to the current directory
|
|
||||||
|
|
||||||
- Syntax: `firebase use --add`
|
|
||||||
- Example: `firebase use --add` interactively adds an existing Firebase project.
|
|
||||||
|
|
||||||
- `firebase projects:create`: Creates a new Firebase project.
|
|
||||||
- Syntax: `firebase projects:create [options]`
|
|
||||||
- Example: `firebase projects:create --display-name "My Project"` creates a new Firebase project with the given display name.
|
|
||||||
|
|
||||||
These are just a few examples of the available commands. You can explore more commands and their options by running `firebase help` or visiting the [official Firebase CLI documentation](https://firebase.google.com/docs/cli).
|
|
||||||
@@ -21,7 +21,6 @@ cat /proc/<process_id>/maps # Show the current virtual memory usage of a Linux
|
|||||||
ip r # Display ip of the server
|
ip r # Display ip of the server
|
||||||
|
|
||||||
lsof -i :9000 # List process running on port 9000
|
lsof -i :9000 # List process running on port 9000
|
||||||
kill -9 $(lsof -t -i:PORT) # Kill the process running on whichever port specified
|
|
||||||
|
|
||||||
journalctl -u minio.service -n 100 --no-pager # List last 100 logs for specific service
|
journalctl -u minio.service -n 100 --no-pager # List last 100 logs for specific service
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ gu$ make lowercase until end of line
|
|||||||
<< indent line one column to left
|
<< indent line one column to left
|
||||||
== auto-indent current line
|
== auto-indent current line
|
||||||
ddp swap current line with next
|
ddp swap current line with next
|
||||||
ddkP swap current line with previous
|
ddkp swap current line with previous
|
||||||
:%retab fix spaces / tabs issues in whole file
|
:%retab fix spaces / tabs issues in whole file
|
||||||
:r [name] insert the file [name] below the cursor.
|
:r [name] insert the file [name] below the cursor.
|
||||||
:r !{cmd} execute {cmd} and insert its standard output below the cursor.
|
:r !{cmd} execute {cmd} and insert its standard output below the cursor.
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#### General
|
#### General
|
||||||
|
|
||||||
- `Ctrl`+`Shift`+`P`, `F1`: Show Command Palette
|
- `Ctrl`+`Shift`+`P`, `F1`: Show Command Palette
|
||||||
- `Ctrl`+`Shift`+`T`: Open last closed tab
|
|
||||||
- `Ctrl`+`P`: Quick Open, Go to File
|
- `Ctrl`+`P`: Quick Open, Go to File
|
||||||
- `Ctrl`+`Shift`+`N`: New window/instance
|
- `Ctrl`+`Shift`+`N`: New window/instance
|
||||||
- `Ctrl`+`W`: Close window/instance
|
- `Ctrl`+`W`: Close window/instance
|
||||||
|
|||||||
Reference in New Issue
Block a user