This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Execute query from string. | |
mysql -D <DATABASE> -h <HOST> -u <USER> -p -e 'DELETE FROM table'; | |
# Dump only tables with specific prefix. *NEEDS REVISION* | |
mysqldump -u <USER> -p <DATABASE> $(mysql -u <USER> -p -D <DATABASE> -Bse "SHOW TABLES LIKE 'PREFIX_%'"); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert a list of pngs to an animated gif. | |
convert -delay 20 -loop 0 *.png animation.gif | |
# Resize image | |
convert image.jpg -resize 150x image_resized.jpg | |
# Resize and crop to size. | |
# Note: specify the smallest dimension in -resize. | |
convert image.jpg -resize x300 -gravity center -crop 400x300+0+0 image_resized_and_cropped.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Canonical host name for your website. | |
# THANKS DRUPAL7. | |
# If your site can be accessed both with and without the 'www.' prefix, you | |
# can use one of the following settings to redirect users to your preferred | |
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option: | |
# | |
# To redirect all users to access the site WITH the 'www.' prefix, | |
# (http://example.com/... will be redirected to http://www.example.com/...) | |
RewriteCond %{HTTP_HOST} . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reset post metas. | |
delete from wp_postmeta where post_id in (select ID from wp_posts where post_type in('attachment','revision','post')) | |
# Reset posts. | |
delete from wp_posts where post_type in('attachment','revision','post') | |
# Migrate blog, from domainOLD.com to domain.com. | |
update wp_options set option_value = 'http://domain.com' where option_name = 'siteurl'; | |
update wp_options set option_value = 'http://domain.com' where option_name = 'home'; | |
update wp_posts set guid = replace(guid, 'http://domainOLD.com', 'http://domain.com'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header("Content-type: text/plain; charset=utf8"); | |
$pwd = dirname(__FILE__); | |
print "$pwd\n"; | |
print exec("du -ch " . escapeshellarg($pwd)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Thanks http://css-tricks.com/snippets/css/media-queries-for-standard-devices/ */ | |
/* Smartphones (portrait and landscape) ----------- */ | |
@media only screen | |
and (min-device-width : 320px) | |
and (max-device-width : 480px) { | |
/* Styles */ | |
} | |
/* Smartphones (landscape) ----------- */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Cleans directory from cvs dir/files. | |
# http://snippets.dzone.com/posts/show/934 | |
find "$1" -name 'CVS' -exec rm -rf '{}' \; -print | |
# Generate fake file with a specific size (useful for uploads) | |
head -c 3000000 /dev/urandom > upload_test_3MB.zip | |
# Extracts count per page name in an access_log Apache file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT column_name,column_type | |
FROM information_schema.columns | |
WHERE table_schema = DATABASE() | |
AND table_name='table' | |
ORDER BY ordinal_position; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Method 1: get both id key and id value. Verbose way. | |
$entity_wrapper = entity_metadata_wrapper($entity_type, $entity); | |
$pri = $entity_wrapper->entityKey('id'); | |
$entity_id = $entity_wrapper->$pri->value(); | |
// Method 2: get only id value. More succint way. | |
list($entity_id) = entity_extract_ids($entity_type, $entity); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://static.bouncingminds.com/ads/5secs/baileys_5sec.mp4 | |
http://static.bouncingminds.com/ads/5secs/dodson_5sec.mp4 | |
http://static.bouncingminds.com/ads/15secs/dogs_600.mp4 | |
http://static.bouncingminds.com/ads/15secs/dogs_600.flv | |
http://static.bouncingminds.com/ads/15secs/horse_how_to_600.mp4 |
OlderNewer