Repeat code, change variable?

So you basically don’t want to keep repeating the same HTML over and over. You should put all of the tags and categories you want to display into an array. Then iterate over that array, querying and printing HTML each time. You could use conditionals to display different HTML where necessary.

$terms = array(
    array(
        'taxonomy' => 'category',
        'terms' => array(1)
    ),
    array(
        'taxonomy' => 'tag',
        'terms' => array('code')
    )
    //...
);

Then iterate over these…

foreach( $terms as $set ) {

    //build args
    $args = array(
        'post_type' => 'post'
    );

    if( $set['taxonomy'] == 'tag' )
        $args['tag_slug__and'] = $set['terms'];

    if( $set['taxonomy'] == 'category' )
        $args['category__in'] = $set['terms'];

    //create new WP_Query
    $query = new WP_Query( $args );

    if( $query->have_posts() ) : 
        while( $query->have_posts() ) :
            $query->the_post();
            ?>

                <!-- HTML -->

            <?php
        endwhile;
    endif;

}

You could also bypass building your own $terms array altogether by using get_terms(), but if you are trying to show variations in display, the above should do the trick.