Skip to content

Instantly share code, notes, and snippets.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://domain.nane/$1 [R,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R=301,L]
sudo nano /etc/apache2/sites-available/test.site.conf
<VirtualHost *:80>
ServerName test.site
ServerAlias www.test.site
ServerAdmin webmaster@localhost
DocumentRoot /var/www/test.site/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
@zgurya
zgurya / .htaccess
Created January 11, 2017 23:08
WordPress .htaccess file with feactures
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R,L]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R=301,L]
jQuery(function($){
$("header li a").click(function(e) {
e.preventDefault();
var elemID=$(this).attr('href');
$('html, body').animate({
scrollTop: $(elemID).offset().top-100
}, 1000);
});
})
/*
* Add options page
*/
if( function_exists('acf_add_options_page') ) {
$option_page = acf_add_options_page(array(
'menu_title' => __('Theme options','textdomain'),
'menu_slug' => 'mytheme-settings',
'capability' => 'edit_posts',
'redirect' => true
@zgurya
zgurya / get_rec_data.php
Created April 22, 2016 21:24
Get sum data from rectangle data
<!DOCTYPE html>
<html>
<head>
<title>Get file data</title>
<meta charset="UTF-8">
</head>
<body>
<?php if(isset($_POST['file_url']) || !empty($_POST['file_url'])):?>
<?php
@zgurya
zgurya / circular_prime.php
Created April 22, 2016 21:22
Search circular prime in range from 2 to 1000000
<?php
$circular_primes=array();
function is_prime ($num){
for ($x = 2; $x <= sqrt($num); $x++)
if (!($num % $x)) return false;
return true;
}
function is_circular($str){
$tmp_array=array();
array_push($tmp_array,$str);