Skip to content

Instantly share code, notes, and snippets.

@sutlxwhx
sutlxwhx / Renamer.php
Last active August 24, 2018 23:13
Rename all files in the current folder according to your list of file names
<?php
/**
* @author https://gist.github.com/sutlxwhx
*
* @version 0.2
*
* @license Apache License 2.0
*
*/
@sutlxwhx
sutlxwhx / Copier.php
Last active August 24, 2018 23:13
Copy specified files to the new directory
<?php
/**
* @author https://gist.github.com/sutlxwhx
*
* @version 0.2
*
* @license Apache License 2.0
*
*/
@sutlxwhx
sutlxwhx / README.md
Last active August 22, 2018 12:11
Use Nginx as a Reverse Proxy to another Nginx

Instroduction

This tutorial will show how you can setup Nginx as a Reverse Proxy to another Nginx server with a least amount of code.

Installation

Point your A DNS record to the first server that will accept the initial request and then redirect it to second server On that first server use the following setup fo default enabled site:

server {
	listen 80;
@sutlxwhx
sutlxwhx / schema.md
Last active August 21, 2018 17:32
Rich snippet with star rating in SERP for your website / article

Introduction

According to Google Introduction to Structured Data either schema.org or JSON-LD markup should be enough for Google to pickup structuted data on your website / article. I used them both. In my experince Google was able to pickup breadcrubs within JSON-LD faster while star rating with schema.org was easily to implement.

Installation

Because most of the code is not visible to visitors and it's ok you you split your breadcrumbs and star rating into different instances on the page I encourage you to set the rating data over the h1 tag. It's better if you use div itemprop="name" and it's bad if you will create 2 isntances of h1 tag just to fit my example.

  • h1 stands for your h1 tag
  • "ratingValue" determines the final rating of your article
@sutlxwhx
sutlxwhx / extract.js
Last active August 20, 2018 18:15
Copy to the clipborad list of all h1/h2/h3 elements on the page
# Declare tag name that you want to extract
var elements = document.getElementsByTagName("h2");
# Create a temporary element where all the data will be stored
var buffer = document.createElement("buffer");
document.body.appendChild(buffer);
# Declare the string var where all the data from the page will be stored
var names = '';
# Create a foor loop and append all new elements to the string
for(var i=0; i<elements.length; i++) {
names += elements[i].innerText + '\n';;