Skip to content

Instantly share code, notes, and snippets.

View npapratovic's full-sized avatar
🏠
Working from home

NIKOLA PAPRATOVIC npapratovic

🏠
Working from home
View GitHub Profile
<?php if (count($errors) > 0) : ?>
<div class="error">
<?php foreach ($errors as $error) : ?>
<p class="alert-warning"><?php echo $error ?></p>
<?php endforeach ?>
</div>
<?php endif ?>
<?php include('server.php') ?>
<!DOCTYPE html>
<html>
<head>
<title>Registracija korisnika. </title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<?php
session_start();
// variable declaration
$username = "";
$country = "";
$email = "";
$first_name = "";
$last_name = "";
$birth_date = "";
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`username` varchar(50) NOT NULL,
`first_name` varchar(50) NOT NULL,
`last_name` varchar(50) NOT NULL,
`email` varchar(100) NOT NULL,
`birth_date` date NOT NULL,
`password` varchar(100) NOT NULL,
`spol` varchar(2) NOT NULL,
`country` varchar(100) NOT NULL
/* Set the background color of body to tan */
body {
background-color: tan;
}
/* On screens that are 1200px or less, set the background color to red */
@media screen and (max-width: 1200px) {
body {
background-color: red;
}
@npapratovic
npapratovic / mobile-first-css.css
Created April 11, 2019 15:45
mobile-first-css-breakpoints
/* smartphones, portrait iPhone, portrait 480x320 phones (Android) */
@media (min-width:320px) {
}
/* smartphones, Android phones, landscape iPhone */
@media (min-width:480px) {
}
@npapratovic
npapratovic / console.log.css
Created September 5, 2019 06:41
See the size of each element on the page, their margin and their padding
/*Different depth of nodes will use different colour allowing you to see the size of each element on the page, their margin and their padding. Now you can easily identify inconsistencies.
*/
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }
* * * * * * * { background-color: rgba(255,0,0,.2); }
* * * * * * * * { background-color: rgba(0,255,0,.2); }
@npapratovic
npapratovic / wordpress-disable-comments.php
Last active November 8, 2019 09:00
Wordpress disable comments without plugin, remove links from admin menu (add this code-snippet to functions.php)
<?php
/*Disable comments from WordPress*/
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
@npapratovic
npapratovic / .htaccess
Created December 2, 2019 12:12 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@npapratovic
npapratovic / import-ics-feed-to-wordpress.php
Last active February 11, 2020 12:45
Import data to WordPress from .ics feed of most popular booking websites (airbnb.com, booking.com, expediapartnercentral.com)
<?php
error_reporting(-1); // reports all errors
ini_set("display_errors", "1"); // shows all errors
ini_set("log_errors", 1);
ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 6.0)');
// https://github.com/MartinThoma/ics-parser/blob/master/class.iCalReader.php
require_once 'class.iCalReader.php';