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 / 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.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 / 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 / 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 / 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 / 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 / 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 / style.css
Last active November 25, 2016 11:03
No bootstraps columns gutter on specific row ( or small gutter)
.row.no-gutter {
margin-left: 0;
margin-right: 0;
}
.row.no-gutter [class*='col-']:not(:first-child),
.row.no-gutter [class*='col-']:not(:last-child) {
padding-right: 0;
padding-left: 0;
}
@joviczarko
joviczarko / functions.php
Created January 22, 2017 13:57
Remove Query String from Static Resources .js/?ver=1.2
/* Remove Query String from Static Resources */
/* Resources with a "?" in the URL are not cached by some proxy caching servers. Remove the query string and encode the parameters into the URL for the following resources: */
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
@joviczarko
joviczarko / page-external-posts.php
Created February 3, 2017 11:06
Load external link and parse it as XML and print some parts of it as HTML
<?php
$remote_url = 'https://example.com';
$xml = simplexml_load_file($remote_url);
$number_of_posts = 10;
?>
<ul>
<?php $i = 1; ?>
<?php foreach($xml->channel->item as $job) : ?>
<li>
<div class="jobtitle">