Skip to content
Türker Yıldırım
Writing
Snippets
About
Search
Snippets
One-liners, regexes and short scripts worth keeping. Copy, adapt, move on.
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
Format a byte count in human-readable units
linux
oop
php
refactoring
Import a JSON file into MongoDB
backup
bash
migrations
mongodb
Copy a MySQL database into another database
backup
bash
migrations
mysql
Disable the WordPress admin bar for non-admins
php
security
wordpress
wp-plugins
Read a BuddyPress profile field value
buddypress
php
wordpress
wp-plugins
Test an Apache config before restarting
apache
bash
deployment
linux
Cache the result of an expensive function in APC
caching
oop
performance
php
Delete all WordPress post revisions
mysql
sql
wordpress
wp-performance
Log PHP errors to a file instead of the browser
deployment
linux
logging
php
Log in over SSH without typing a password
bash
linux
security
ssh
Import a large SQL file into MySQL from the command line
backup
bash
migrations
mysql
Change the character set of a MySQL table
backup
migrations
mysql
sql
Disable a submit button after the first click
css
html
javascript
jquery
Truncate a string to a number of words in JavaScript
css
html
javascript
jquery
Hide the BuddyPress admin bar from logged-out visitors
buddypress
php
wordpress
wp-plugins
Find tables without a primary key in MySQL
indexing
mysql
query-optimization
sql
Generate a random password in PHP
linux
oop
php
security
Compress a directory and send it to another server
backup
bash
linux
ssh
Show the ten largest files on a server
bash
linux
monitoring
vps
Stop WordPress from generating extra image sizes
php
wordpress
wp-performance
wp-plugins
Add a tab to the WooCommerce product page
php
woocommerce
wordpress
wp-plugins
Install a Composer package without editing composer.json
bash
composer
deployment
php
Show a loading indicator while a jQuery AJAX call runs
css
html
javascript
jquery
Detect a failed jQuery AJAX request
html
javascript
jquery
php
Redirect to another URL in PHP
html
oop
php
security
Make a triangle in CSS without an image
css
html
javascript
jquery
Push a footer to the bottom of a short page
bootstrap
css
html
javascript
Style a file input to match the rest of the form
css
html
javascript
jquery
Newer
1
…
3
4
5
6
Older