This file contains hidden or 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 | |
$mysqli = new mysqli("localhost", "my_user", "my_password", "world"); | |
/* check connection */ | |
if (mysqli_connect_errno()) { | |
printf("Connect failed: %s\n", mysqli_connect_error()); | |
exit(); | |
} | |
$city = "Amersfoort"; |
This file contains hidden or 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
document.querySelector("input").addEventListener("keypress", function (evt) { | |
if (evt.which < 48 || evt.which > 57) | |
{ | |
evt.preventDefault(); | |
} | |
}); |
This file contains hidden or 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 | |
$datetime1 = strtotime('May 3, 2012 10:38:22 GMT'); | |
$datetime2 = strtotime('06 Apr 2012 07:22:21 GMT'); | |
$secs = $datetime2 - $datetime1;// == <seconds between the two times> | |
$days = $secs / 86400; | |
?> |
This file contains hidden or 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
window.location.search //get the url parameters as string | |
window.location.search.substr(1).split('&') //removes query mark and arrange all parameters in array |
This file contains hidden or 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 | |
//using end() function to find last array key changes the array pointer, which can cause problems. | |
$array = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 2); | |
// Get array keys | |
$arrayKeys = array_keys($array); | |
// Fetch last array key | |
$lastArrayKey = array_pop($arrayKeys); | |
//iterate array | |
foreach($array as $k => $v) { |
This file contains hidden or 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 | |
function numeric_pagination() { | |
global $wp_query; | |
$total_pages = $wp_query->max_num_pages; | |
if ($total_pages > 1){ | |
$current_page = max(1, get_query_var('paged')); | |
echo paginate_links(array( |
This file contains hidden or 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 | |
function wp_custom_logo(){ | |
add_image_size('theme-logo', '160', '90'); | |
add_theme_support('custom-logo', array( | |
'size' => 'theme-logo' | |
)); | |
} | |
add_action('after_setup_theme', 'wp_custom_logo'); | |
?> |
This file contains hidden or 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 | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php | |
*/ | |
$args = array( |
This file contains hidden or 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
.note:before { | |
content: ""; | |
position: absolute; | |
top: 0; | |
right: 0; | |
border-width: 0 16px 16px 0; | |
border-style: solid; | |
border-color: #658E15 #fff; | |
} |
NewerOlder