Skip to content

Instantly share code, notes, and snippets.

@wayphorier
wayphorier / Add-ESLint-to-Laravel-Mix.md
Last active June 24, 2020 08:03 — forked from EmadAdly/Add-ESLint-to-Laravel-Mix.md
Adding eslint to your Laravel application

1. Add eslint and eslint-loader and eslint-plugin-vue to your projects package.json file

npm i eslint eslint-loader eslint-plugin-vue --save-dev

2. Create a base configuration by --init

@wayphorier
wayphorier / gist:971f1b9e1593bec94dab01f85eb8c9f2
Created December 14, 2019 18:17 — forked from adamstac/gist:7462202
Install and configure Sendmail on Ubuntu

Install and configure Sendmail on Ubuntu

This should help you get Sendmail installed with basic configuration on Ubuntu.

  1. If sendmail isn't installed, install it: sudo apt-get install sendmail
  2. Configure /etc/hosts file: nano /etc/hosts
  3. Make sure the line looks like this: 127.0.0.1 localhost yourhostname
  4. Run Sendmail's config and answer 'Y' to everything: sudo sendmailconfig
  5. Restart apache sudo service apache2 restart
@wayphorier
wayphorier / snakeoil.sh
Last active December 14, 2019 14:40 — forked from yyuu/snakeoil.sh
Generate snakeoil SSL certificates on Ubuntu
sudo apt-get install ssl-cert
sudo make-ssl-cert generate-default-snakeoil
sudo usermod --append --groups ssl-cert root
ls -l /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/private/ssl-cert-snakeoil.key
@wayphorier
wayphorier / RandomString
Created August 3, 2018 06:37 — forked from karlgroves/RandomString
PHP Function to create random alphanumeric strings
/**
* function to generate random strings
* @param int $length number of characters in the generated string
* @return string a new string is created with random characters of the desired length
*/
function RandomString($length = 32) {
$randstr = '';
srand((double) microtime(TRUE) * 1000000);
//our array add all letters and numbers if you wish
$chars = array(
@wayphorier
wayphorier / functions.php
Created July 20, 2018 17:04
Human time duration string to ISO 8601
/**
* @version 1.0.0
* Приводит строку к формату временного интервала ISO 8601 (только часы, минуты, секунды)
*
* @var string $duration_by_human Строка в понятном для человека формате (напр., 3 часа 22 минуты 15 секунд)
* @var string $period_designator Указатель временного периода
*
* @return string Отформатированная строка
*
* @see https://en.wikipedia.org/wiki/ISO_8601 Документация по ISO_8601
@wayphorier
wayphorier / functions.php
Last active July 20, 2018 18:18
WordPress Post author link filter for adding Schema.org itemprop attribute
function schema_org_author_posts_link( $link ) {
$link = sprintf( '<a itemprop="author" itemscope itemtype="https://schema.org/Person" href="%1$s" title="%2$s" rel="author"><span itemprop="name">%3$s</span></a>',
esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
/* translators: %s: author's display name */
esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),
get_the_author()
);
return $link;
}
@wayphorier
wayphorier / sftp.json
Created July 20, 2018 13:09
VS Code SFTP base config
{
"protocol": "sftp",
"host": "",
"username": "",
"password": "",
"remotePath": "",
"uploadOnSave": false,
"ignore": [
".vscode", ".node", ".webpack", ".git", ".gitignore"
],
@wayphorier
wayphorier / functions.php
Last active July 20, 2018 14:18
WordPress Custom popup-share links
/**
* Выводит блок ссылок на средства публикации соцсетей
*/
function wph_share_links() {
global $post;
echo '<div class="share">';
$url = urlencode( get_permalink( $post->ID ) );
$title = urlencode( get_the_title( $post->ID ) );
$description = urlencode( get_the_excerpt( $post->ID ) );