Collection of things that I've learned day to day.
- Are the two trees the same
- Best time to buy and sell stock
- Breadth first search
- Binary search
- Binary search tree
- Binary tree level order traversal
- Check if number is prime
- Check if string is palindrom
- Climbing stairs
- Convert sorted array to Balanced Search Tree (BST)
- Count and say
- Decimal to binary
- Djikstra
- Excel sheet column title
- Excel sheet column number
- Factorial
- Fibonacci
- Fibonacci math
- Find greatest common divisor
- Find index of target in sorted array
- Find max depth of binary tree
- Intersection of two linked lists
- Is binary tree balanced
- Is linked list cycilc (Floyd's cycle finding algorithm)
- Is the tree symmetrical
- Kadane's algorithm (maximum subarray)
- Knight's dialer
- Length of last word
- Linked list
- Longest common prefix
- Majority element (Boyer-Moore Voting Algorithm)
- Memoization and tabulation
- Merge sort
- Merge sorted array
- Merge two sorted lists
- Minimum depth of binary tree
- Palindrome number
- Pascal's triangle
- Pascal's triangle II
- Path sum in binary tree
- Plus one
- Queues
- Quicksort with Hoare's partitioning scheme
- Quicksort for associative array
- Quicksort
- Radixsort
- Remove duplicates from sorted array
- Remove duplicates from sorted list
- Remove element from array
- Reverse integer
- Roman to integer
- Selection sort
- Single number
- Stacks
- Sum of binary numbers
- Valid parentheses
- Attach running container to a network
- Build from scratch
- Connect to a local network from inside a container
- Container filtering
- Display disk space used by docker
- Get a list of all containers
- Get container IP address
- Get containers IP inside a specific network
- Inspect container
- List all containers belonging to a network
- List all networks a container belongs to
- Remove containers
- Remove everything (all dangling images, stopped containers, all unused netwroks)
- Remove images
- Remove networks
- Remove volumes
- Checkout old version of a file
- Clean out all local branches
- Commit all code in single commit
- Delete references of remote branches that don't exist
- Delete untracked files
- Don't clone entire repo history
- Find changed files
- Find the initial commit
- Get single file from stash
- Git add files interactively
- Ignore changes to a tracked file
- Last commit a file appeared in
- Make backup of untracked files
- Move the latest commit to a new branch
- Open all files with conflicts at once
- Overwrite local with remote
- Push only specific commit to branch
- Push to multiple git repos
- Remove file from git without removing it locally
- Remove a file from last commit
- Rename branch
- Restoring deleted files
- Revert added files interactively
- Revert to some commit
- Search for some string in commits
- Stash untracked files
- Untrack a file without deleting it locallt
- Viewing file on another branch
- Append elements to DOM without reflow
- Array to CSV
async/await
not working withforEach()
- Basic Date Formatting Without A Library
- Bind
forEach
onNodeList
- Bitwise division by 2 floored (right shift)
- Bitwise left shift
- Bitwise
Math.floor()
- Bitwise swap two variables
- Capitallize every word
- Capitallize first letter
- Check if bottom of a page is visible
- Check if element has class
- Check if element is visible in viewport
- Check if year is leap year
- Check if two arrays have the same vallues (unordered and for primitive values)
- Check if two numbers are approximately equal
- Check number of times function is executed in ine second
- Clone array of objects
- Comma operator
console.log()
that auto-indents based on the depth of the call stack- Convert
nodeList
toarray
- Convert RGB to HEX
- Convert string to camelcase
- Cookie serialization
- Create alias for JS path
- Debounce
- Deep clone object
- Default parameter can be value or function
- Defer execution of a function
- Distance between two points
- Find difference between two arrays
- Dynamic imports
- Emulate
async/await
with generator - Execute function with a delay without hanging the entire script
- Find the length of string in bytes
- Flatten an array
- Force object immutability
- Format number to currency
- Generators
- Get days between dates
- Get highest date
- Get indexes of value in array
- Get month names
- Get scroll position
- Get style of elements
- Get time from date
- Get weekdays names
- Intersection
- Is after date
- Is anagram
- Is before date
- Is browser
- Is browser tab focused
- Is iterable like an array
- Is same date
- Make simple router
- Module pattern (export func.)
- Open link in new window
- Pad a string on both sides
- Parent contains the child element
- Partition an array
pub/sub
event hub- Read from file
- Remove elements from array
- Remove HTML/XML tags from string
- Render PDF in PDF view
- Return all non-falsy values from an array
- Run event listener only once
- Scroll to element
- Scroll to top smoothly
- Set
- Set CSS
- Sleep in async function
- Split number to digits
- Split values in two groups
- Swap variables
- Tagged template literals
- Throttle
- Use
map
insteadobject
as Hash Map - With statement
- Optimizations
- refactoring
- Add multiple files in zip archive
- Avoid "no such column" error when dropping multiple columns in sqlite
- Avoid deeply nested loops with eachSpread
- Bulk filling model attributes
- Call "each" as a property instead of a method
- Cheatsheet for belongsToMany relationship methods
- Compare two models
- Create blade directive
- Creating relationships in factories
- Error code blade pages
- Errors variable
- Factory callbacks
- Fallback when no other route is matched
- Force HTTPS
- Get only needed fields from relationship
- Group Route::resource() into one statement
- Handle 419 session token expired error in SPA context
- Hook trait into the construct() method of a model from a trait
- Increment/decrement an integer database column
- Inline static caching
- Limit possible values for route parameters
- Load first existng view
- Login user only for one request
- Macros
- Magic methods on eloquent where caluses
- Mix and match blade directives
- Override the default reset password functionality
- Persist request data when redirecting
- pipe method
- Pivot renaming in
belongsToMany
relationship - Preview mailables
- Put where clauses in brackets
- Query date with index
- redirectTo as method
- Reorder models trait
- Save model and its relationships in one go
- Searching multiple columns
- setRelation won't run a DB query
- Soft deletes won't work with Query Builder
- Spliting tasks into steps
- Tap into collection at any point without affecting the original collection
- Tap method
- Throw an exception based on condition
- Timestamps with timezone
- Using subdomains for specific app areas
- Wildcard subdomains
- Better manual
- Brace expansion
- Cat a file with line numbers
- Catch errors
- Check if port is in use
- Check ubuntu version
- Compare local and remote files
- Concat multiple videos in one
- Configure you server timezone
- Copy file from SSH
- CRON for database backup
- Dispaly network-related information such as open connections, open socket ports, etc
- Display the process tree
- Editing long commands in editor
- Embed a comment within a chain of commands
- Find and kill processes by name
- Command: find
- Find the command thats using some port
- Forward Multiple Ports Over SSH
- Hexdump compiled file
- Kill Everything Running On A Certain Port
- Killing a frozen SSH session
- List open files and corresponding processes
- List the statuses of all upstart jobs
- Recursive create folders
- Redirect standard output and standard error
- Run a command without putting it in history
- Run background process forever
- Run commands on multiple CPU cores
- Screen command
- Search through command history
- Searching for a file
- See and use recent commands
- Setting up nginx reverse proxy
- Show how long system has been running
- SSH
- String manipulation on the command line
- Style bash script text
- Subshells
- Switching the shell to another user
- Transfer files
- Treat output of a command like a file
- Useful one-liners
- Variable expansion
- Magic methods
- pattrens
- refactoring
- SOLID
- Working with images
- Access private and protected methods
- Array functions
- Building HTTP query
- Calculate the similarity between two strings
- Call trait method with our custom name
- Check from where some method has been called
- Check the execution time of a script
- Creating temporary file
- CURL
- DateTime::createFromFormat('Y-m-d', '0000-00-00') issue
- Difference between two dates in days
- Execute a function after the script ends
- Flatten an array
- goto keyword
- Grouped namespaces
- Loop through a class
- Make class act as array
- Memory usage in MB
- Merge arrays
- Merge multidimensional arrays
- Named constructor
- PDO
- Reflection
- Run a script even if the client has disconnected
- Spaceship operator
- Static variables inside the body of a function
- The
+
operator for merging arrays - Variable validation with ctype functions
- Variadic function
- Add index
- Alter table
- Analyse table for optimal types
- Check the fragmentation for a table
- Check size of table, DB, index
- Clone some table
- Create table
- Creating a database
- Delete database
- Delete table
- Don't allow any update or delete statements wihout a where
- Export DB
- Fulltext indexes
- Import DB
- Insert into table
- Joins
- Move table from one database to another in the same cluster
- MySql index
- Pattern matching (searching)
- Print info for all tables
- Selecting data
- Set table type
- Setting priorities
- Show fields in the table
- SQL functions
- Update data
- Using aliases
- WHERE clauses with AND and OR