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 | |
// (Laravel) | |
use Tests\TestCase; | |
use Carbon\Carbon; | |
class TimeCounterTest extends TestCase | |
{ | |
public function test_duration() | |
{ | |
$counter = new TimeCounter(); |
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 () { | |
// An object with options for the IntersectionObserver. | |
const options = { | |
// 0.5 = The callback is fired when 50% of the element is visible | |
// We can add more values to the array, like 0.25, 0.75 or 1.0 | |
threshold: [0.5] | |
}; | |
// Instantiate the IntersectionObserver class | |
const observer = new IntersectionObserver((entries, observer) => { |
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
var results = [ | |
{ | |
answer: "2", | |
question: "12" | |
}, | |
{ | |
answer: "1", | |
question: "13" | |
}, | |
{ |
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 | |
/** | |
* Register the custom taxonomy. | |
*/ | |
add_action( 'init', 'register_taxonomy_article_type' ); | |
function register_taxonomy_article_type() { | |
register_taxonomy( 'article_type', 'post', array( | |
'label' => 'Article type', | |
'hierarchical' => true, |
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
export const pageQuery = graphql` | |
query($slug: String) { | |
allWordpressPost(sort: {order: ASC, fields: date}) { | |
edges { | |
node { | |
featured_media { | |
localFile { | |
childImageSharp { | |
fluid(sizes: "(min-width: 1280px) 327px, (min-width: 768px) 39vw, 81vw") { | |
src |
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
// Does not work! 😕 | |
export default { | |
props: ['todo'], | |
data() { | |
const data = this.todo; | |
data.isComplete = false; | |
return data; | |
}, | |
watch: { | |
isComplete: function(value) { |
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 | |
add_action( 'pre_get_posts', function( $query ) { | |
if ( ! is_admin() && is_post_type_archive( 'articles' ) ) { | |
$query->set('posts_per_page', 1); | |
} | |
} ); |
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 | |
/* | |
Template name: My custom archive page | |
*/ | |
$posts = new WP_Query( array( | |
'post_type' => 'articles', | |
'posts_per_page' => 1, | |
'paged' => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1 | |
) ); |
NewerOlder