Skip to content

Instantly share code, notes, and snippets.

View romanoffs's full-sized avatar
🎯
Focusing

Денис romanoffs

🎯
Focusing
View GitHub Profile
@romanoffs
romanoffs / common.js
Created August 10, 2017 16:56
preloader
#loader {
background: none repeat scroll 0 0 #ffffff;
bottom: 0;
height: 100%;
left: 0;
position: fixed;
right: 0;
top: 0;
width: 100%;
z-index: 9999;
@romanoffs
romanoffs / common.js
Created August 10, 2017 17:14
Background 100%
function heightDetect() {
$(".main_head").css("height", $(window).height());
};
heightDetect();
$(window).resize(function() {
heightDetect();
});
@romanoffs
romanoffs / init.example.php
Created October 13, 2017 10:30
Makes the first letter of the line in the capital
<?php
/**
* Makes the first letter of the line in the capital
* @return string
*/
function upFirstLetter($str, $encoding = 'UTF-8')
{
return mb_strtoupper(mb_substr($str, 0, 1, $encoding), $encoding)
. mb_substr($str, 1, null, $encoding);
}
@romanoffs
romanoffs / Security Headers (nginx)
Last active June 16, 2018 22:08
Security Headers
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options "SAMEORIGIN";
add_header Referrer-Policy "strict-origin-when-cross-origin";
add_header X-Download-Options "noopen";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
add_header X-Content-Type-Options "nosniff";
add_header Content-Security-Policy-Report-Only "";
@romanoffs
romanoffs / moment.js
Created June 16, 2018 22:03
get RU localization
/**
* Customize locale Moment JS
* @description Enables Moment.js plugin
*/
(function() {
function plural(word, num) {
var forms = word.split('_');
return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]);
}
@romanoffs
romanoffs / CanActivate.dart
Created July 14, 2018 20:09 — forked from kulshekhar/CanActivate.dart
AngularDart sample using CanActivate
import 'dart:html';
import 'package:angular2/core.dart';
import 'package:angular2/router.dart';
@Component(
selector: 'my-app',
styleUrls: const ['app_component.css'],
template: '''
<h1>My First Angular 2 App</h1>
@romanoffs
romanoffs / gist:76414c57530338f83468e7e4d5b2e7a3
Created August 11, 2018 19:04 — forked from Neolot/gist:3964380
PHP Склонение числительных
<?php
/**
* Функция склонения числительных в русском языке
*
* @param int $number Число которое нужно просклонять
* @param array $titles Массив слов для склонения
* @return string
**/
$titles = array('котик', 'котика', 'котиков');
function declOfNum($number, $titles)
@romanoffs
romanoffs / nginx.default.conf
Created August 23, 2018 12:25 — forked from sumardi/nginx.default.conf
Install PHP-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and PHP-FPM
sudo yum install -y nginx php-fpm
# Install PHP extensions
sudo yum install -y php-devel php-mysql php-pdo \
php-pear php-mbstring php-cli php-odbc \
@romanoffs
romanoffs / gist:4a7502e6f353e0ae6e4dd0776d51b4d0
Created August 29, 2018 16:06
wget download all images form single web page
wget -nd -r -P /Users/denisromanenko/Downloads/villa/ -A jpeg,jpg,bmp,gif,png --no-check-certificate --no-parent --timestamping --convert-links --page-requisites --no-directories --no-host-directories -erobots=off https://www.somesite/index.html
@romanoffs
romanoffs / README.md
Created September 4, 2018 14:03 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet