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
var d1 = new $.Deferred(); | |
var d2 = new $.Deferred(); | |
$.when(d1, d2).then(function(r1, r2) { | |
console.log(r1); | |
console.log(r2); | |
alert('done'); | |
}); | |
$.get(href1, function(data) { d1.resolve( data ); }) | |
$.get(href2, function(data) { d2.resolve( data ); }) |
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
// without prepared statements | |
$sql->query("SELECT ID FROM table WHERE condition1 = 'foo' AND condition2 = 2")->fetch_object()->ID; | |
// with prepared statements | |
$query = $sql->prepare("SELECT ID FROM table WHERE condition1 = ? AND condition2 = ?"); | |
$query->bind_param("si", $a='foo', $b=2); | |
$query->execute(); | |
$query->get_result()->fetch_object()->count; |
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
„Text“ |
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
new_count = 500; | |
cur_count = $('.count').text(); | |
$({count_num: cur_count}).animate({count_num: overall_count}, { | |
duration: 1000, | |
easing:'linear', | |
step: function() { | |
$('.count').text(Math.floor(this.count_num)); | |
}, | |
complete: function() { | |
$('.count').text(this.count_num); |
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 | |
$sql->query("SELECT * FROM table WHERE ID = 1;")->fetch_assoc(); | |
?> |
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 | |
// this is only possible with mysqlnd (native driver) | |
$result = $sql->query("SELECT * FROM table WHERE condition = 1;")->fetch_all(MYSQLI_ASSOC); | |
// this is always possible | |
$result = array(); $result_db = $sql->query("SELECT * FROM table WHERE condition = 1;"); while($row = $result_db->fetch_assoc()) { $result[] = $row; } | |
?> |
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
echo '<meta http-equiv="refresh" content="0; url=\''.$url.'\'">'; |
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
JRoute::_('index.php?Itemid=106') |
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
<div class="slider"> | |
<div class="item"> | |
<ul> | |
<li style="background-image:url('http://lorempixel.com/g/640/480/cats/');"></li> | |
<li style="background-image:url('http://lorempixel.com/g/640/480/cats/');"></li> | |
<li style="background-image:url('http://lorempixel.com/g/640/480/cats/');"></li> | |
<li style="background-image:url('http://lorempixel.com/g/640/480/cats/');"></li> | |
<li style="background-image:url('http://lorempixel.com/g/640/480/cats/');"></li> | |
<li style="background-image:url('http://lorempixel.com/g/640/480/cats/');"></li> | |
<li style="background-image:url('http://lorempixel.com/g/640/480/cats/');"></li> |
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 | |
add_filter( 'upload_mimes', function( $existing_mimes = [] ) | |
{ | |
$existing_mimes['vcf'] = 'text/x-vcard'; | |
$existing_mimes['svg'] = 'image/svg+xml'; | |
$existing_mimes['ico'] = 'image/x-icon'; | |
return $existing_mimes; | |
}); | |
// this is needed for all wordpress versions >= 4.7.1 | |
// this is also needed for svg files without proper mime types (without the <?xml tag inside!) |