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
Search empty CSS selectors | |
/{\n\t\n} | |
Change filetype, syntax (htt, tpl, etc.) | |
:set ft=html.php | |
Delete every line in the file that does match a pattern |
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
(function ($) { | |
var cache = {}, | |
q = $( '#q' ); | |
qval = q.val(); | |
q.focus(function() { | |
if(q.val() == qval) { | |
q.val(''); | |
} |
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 limited rows (paging) and left join additional data, http://stackoverflow.com/a/16767018/289404 | |
SELECT t1.*, t2.* | |
FROM (SELECT * FROM table t WHERE t.id > 100 LIMIT 100) t1 | |
LEFT JOIN table2 t2 ON t1.id = t2.id | |
ORDER BY t1.id DESC | |
-- select table column names | |
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name='table'; | |
-- find duplicate |
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
# MySQL config file | |
[client] | |
port = 3306 | |
socket = /tmp/mysql.sock | |
[mysqld] | |
port = 3306 | |
socket = /tmp/mysql.sock | |
skip-external-locking |
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 | |
$pdo = new PDO("mysql:host=HOSTNAME", "USERNAME", "PASSWORD"); | |
$query = $pdo->prepare("SHOW DATABASES"); | |
$query->execute(); | |
foreach ($query->fetchAll(PDO::FETCH_OBJ) as $row) { | |
$db = $row->Database; | |
echo "= $db =" . PHP_EOL; | |
$pdo->exec("USE $db"); |
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
/* | |
Additional info | |
http://stackoverflow.com/a/7717572/289404 | |
http://stackoverflow.com/a/3379169/289404 | |
*/ | |
(function ($) { | |
if ( window.location.hash == '#reference' ) { | |
$('html, body').animate({ | |
scrollTop: $( '#reference' ).offset().top | |
}, 1000); |
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
yepnope([{ | |
load: base_url + '/include/jquery/jquery.jqtransform.js', | |
complete: function () { | |
$('.jqtransform').jqTransform(); | |
} | |
}, { | |
load: base_url + '/include/jquery/jquery.fileinput.js', | |
complete: function () { | |
$('#file').customFileInput(); | |
} |
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
// video source http://wordpress.tv/2013/03/15/andrew-nacin-wp_query-wordpress-in-depth/ | |
// presentation http://www.slideshare.net/andrewnacin/you-dont-know-query-wordcamp-netherlands-2012 | |
$q = new WP_Query(); | |
while ( $q->have_posts() ): | |
$q->the_post(); | |
endwhile; | |
wp_reset_postdata(); | |
// or in the template functions.php |
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 | |
require dirname(__FILE__) . '/functions.php'; | |
$module = md5('MODULE_NAME'); | |
$page_url = sanitize($_SERVER['PHP_SELF']); | |
if (isset($_POST['firstname'])) | |
require dirname(__FILE__) . '/save.php'; |
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 | |
/* | |
Plugin Name: R Debug | |
Description: Set of helper dump functions for debug. | |
Author: Andrey "Rarst" Savchenko | |
Author URI: http://www.rarst.net/ | |
License: GPLv2 or later | |
License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
*/ |
OlderNewer