Skip to content

Instantly share code, notes, and snippets.

View joviczarko's full-sized avatar
🎯
Focusing

Jović Žarko joviczarko

🎯
Focusing
View GitHub Profile
@joviczarko
joviczarko / domain2.com.conf
Created November 16, 2016 09:37
Domain redirection from the apache virtual hosts file
<VirtualHost *:80>
ServerName www.domain1.com
ServerAlias domain1.com
Redirect / http://www.domain2.com
</VirtualHost>
<VirtualHost *:80>
ServerName www.domain3.com
ServerAlias domain3.com
Redirect 301 / http://www.domain2.com
@joviczarko
joviczarko / index.html
Last active November 9, 2016 14:47
Bootstrap column vertical centered (middle aligned) divs
<div class="row">
<div class="col-xs-6 vcenter">
<div>Div1</div>
</div>
<div class="col-xs-6 vcenter">
<div>Div2</div>
</div>
</div>
@joviczarko
joviczarko / style.css
Last active April 25, 2020 17:36
Five columns Bootstrap grid (BOOTSTRAP v3!) (Adding five column layout for bootstrap)
.col-xs-5ths,
.col-sm-5ths,
.col-md-5ths,
.col-lg-5ths {
position: relative;
min-height: 1px;
padding-right: 10px;
padding-left: 10px;
}
@joviczarko
joviczarko / page.php
Created October 26, 2016 21:55
Page header with featured image as background in wordpress
<?php if (has_post_thumbnail( $post->ID ) ): ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
<header class="entry-header entry-header-background" style="background-image: url('<?php echo $image[0]; ?>')">
<?php else: ?>
<header class="entry-header">
<?php endif; ?>
<div class="container">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</div>
</header><!-- .entry-header -->
@joviczarko
joviczarko / page-subscribe.php
Created October 21, 2016 08:02
Sending form data to an API URL (Postman app helped to test API)
<?php
/*
Template Name: Subscribe Page
*/
get_header();
if( isset($_POST['subscriber_email']) ){
$api_url = 'http://API_URL';
$subscriber_name = $_POST['subscriber_name'];
@joviczarko
joviczarko / style.css
Created October 16, 2016 07:37
Default bootstrap media queries
/* Extra small devices (phones, less than 768px) */
/* No media query since this is the default in Bootstrap */
/* Small devices (tablets, 768px and up) */
@media (min-width: 768px) {
}
/* Medium devices (desktops, 992px and up) */
@media (min-width: 992px) {
@joviczarko
joviczarko / mysql-backup.bat
Last active March 28, 2023 08:13
Automatic MySQL database backup (dump) bat file for wamp server
@ECHO OFF
For /f "tokens=2-4 delims=. " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-3 delims=.:," %%a in ("%TIME%") do (set mytime=%%a-%%b-%%c)
set TIMESTAMP=%mydate%_%mytime%
REM Export all databases into file E:\wamp64\backup\database_backup.[year][month][day].sql
"E:\wamp64\bin\mysql\mysql5.7.14\bin\mysqldump.exe" --all-databases --result-file="E:\wamp64\backup\database_backup_%TIMESTAMP%.sql" --user=root
REM Change working directory to the location of the DB dump file.
@joviczarko
joviczarko / style.scss
Created September 29, 2016 09:16
Link sass mixin
$transition_link: all 0.3s ease;
@mixin link ($link, $visited, $hover, $active) {
& {
color: $link;
transition: $transition_link;
&:visited {
color: $visited;
}
&:hover {
@joviczarko
joviczarko / gist:b4fd93e5631b42f9271c5366b0a7c8f6
Created September 21, 2016 10:32
Do something after scrolling certain amount
function home_navbar_toggle() {
if ($(window).scrollTop() > 100) {
$('nav.navbar-home').addClass('nav-scrolled');
}
else {
$('nav.navbar-home').removeClass('nav-scrolled');
}
};
@joviczarko
joviczarko / content-archive.php
Created September 21, 2016 07:03
Right way of calling the featured image on WordPress archive page
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail(); ?>
</a>
<?php endif; ?>