Türker Yıldırım
Writing
Snippets
About
Search
Snippets
One-liners, regexes and short scripts worth keeping. Copy, adapt, move on.
Raise the WordPress memory limit for the admin only
deployment
php
wordpress
wp-performance
Regenerate all WordPress thumbnails after changing an image size
bash
wordpress
wp-cli
wp-performance
Minify JavaScript and CSS with Grunt
css
html
javascript
linting
Show the size of every index on a table
indexing
mysql
query-optimization
sql
Make iptables rules survive a reboot
bash
firewall
linux
security
Detect when the user has scrolled to the bottom of the page
html
javascript
jquery
performance
Find the slowest PHP-FPM requests in the slow log
logging
monitoring
nginx
php
Convert a date string between two formats in PHP
linting
oop
php
refactoring
Limit the request rate for one URL in nginx
deployment
nginx
performance
security
Show a custom checkbox without a JavaScript plugin
bootstrap
css
html
javascript
Check which SSL protocols a server accepts
bash
monitoring
security
tls
Update the query string without reloading the page
html
javascript
jquery
refactoring
Find which files a running process has open
bash
deployment
linux
monitoring
Check whether a string starts with a prefix in PHP
linting
oop
php
refactoring
Show the OPcache hit rate
opcache
performance
php
profiling
Show the InnoDB status after a lock wait timeout
logging
monitoring
mysql
sql
Stream a large file download without exhausting memory in PHP
logging
oop
performance
php
Get the number of days between two dates in PHP
design-patterns
oop
php
refactoring
Show free disk space and inode usage
bash
linux
monitoring
vps
Convert an array to XML in PHP
api-design
oop
php
refactoring
Scroll to an element smoothly with jQuery
css
html
javascript
jquery
Style a placeholder across browsers
css
html
javascript
linting
Vertically centre a block of unknown height
bootstrap
css
html
javascript
Install a WordPress plugin from the command line
bash
wordpress
wp-cli
wp-plugins
Escape output for an HTML attribute in PHP
html
linting
php
security
Serialize a form to JSON with jQuery
api-design
html
javascript
jquery
Show the MySQL queries running right now
monitoring
mysql
query-optimization
sql
Copy an SSH public key to a server
bash
linux
security
ssh
Check whether OPcache is enabled
monitoring
opcache
performance
php
Make a wide table scroll on a small screen
bootstrap
css
html
javascript
Add an index to a large MySQL table
indexing
migrations
mysql
sql
Restart PHP-FPM without dropping requests
bash
deployment
nginx
php
Delete all Redis keys matching a pattern
bash
caching
performance
redis
Change the WooCommerce add-to-cart button text
php
woocommerce
wordpress
wp-plugins
List the enabled Apache modules
apache
bash
deployment
linux
Read a CSV file into an array in PHP
migrations
oop
php
refactoring
Detect when an image has finished loading
html
javascript
jquery
performance
Redirect a whole domain to another in nginx
deployment
linux
nginx
security
Block an IP range with iptables
bash
firewall
linux
security
Send a POST request with cURL in PHP
api-design
oop
php
security
Newer
1
2
3
4
5
6
Older