Skip to content

Instantly share code, notes, and snippets.

@edalis
edalis / cookie.js
Created May 10, 2018 08:55
JavaScript getCookie(), setCookie(), deleteCookie()
@edalis
edalis / time-converter.js
Created May 10, 2018 08:46
JavaScript Time Converter
function timeConverter(UNIX_timestamp) {
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const monthsRu = ['Января', 'Февраля', 'Марта', 'Апреля', 'Мая', 'Июня', 'Июля', 'Августа', 'Сентября', 'Октября', 'Ноября', 'Декабря'];
let date = new Date(UNIX_timestamp);
let year = date.getFullYear();
let month = monthsRu[date.getMonth()];
let day = date.getDate();
@edalis
edalis / App\Exceptions\Handler.php
Created February 11, 2017 08:28 — forked from jacurtis/App\Exceptions\Handler.php
How to get filp/whoops to work in Laravel 5.2 or 5.3 - Add this code to your `App\Exceptions\Handler.php` file.
/**
* Create a Symfony response for the given exception.
*
* @param \Exception $e
* @return mixed
*/
protected function convertExceptionToResponse(Exception $e)
{
if (config('app.debug')) {
$whoops = new \Whoops\Run;
@edalis
edalis / header.php
Created November 23, 2016 08:49
PHP: Charset
<?php
header('Content-Type: text/html; charset=utf-8');
@edalis
edalis / .htaccess
Created November 23, 2016 08:39
Charset
AddDefaultCharset utf-8
# PHP version >= 5.6
php_flag default_charset utf-8
@edalis
edalis / .htaccess
Last active November 12, 2016 07:59
Laravel: Redirect to ./public
RewriteEngine On
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
@edalis
edalis / .htaccess
Last active November 5, 2016 08:33
Redirect http:// to https://, http://www to https://
## https://www.reg.ru/support/hosting-i-servery/sajty-i-domeny/kak-dobavit-redirekt/redirekt-s-http-na-https
## вариант 1
RewriteEngine On
RewriteCond %{HTTPS} =on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L]
## вариант 2
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
@edalis
edalis / delay-posts-rss.php
Last active October 17, 2016 07:30
WP: Delay Posts in RSS
// http://www.wpbeginner.com/wp-tutorials/how-to-delay-posts-from-appearing-in-wordpress-rss-feed/
function publish_later_on_feed($where) {
global $wpdb;
if ( is_feed() ) {
// timestamp in WP-format
$now = gmdate('Y-m-d H:i:s');
// value for wait; + device
@edalis
edalis / link_target_blank.html
Last active October 16, 2016 13:59
Link Target Blank
@edalis
edalis / format-detection.html
Last active October 16, 2016 14:02
Format Detection
// For Safari (iPhone / IPod / IPad) and Android
<meta name="format-detection" content="telephone=no"