Skip to content

Instantly share code, notes, and snippets.

View kosmala007's full-sized avatar

Marcin Kosmala kosmala007

View GitHub Profile
@kosmala007
kosmala007 / bootstrap-gutters.scss
Created February 23, 2020 14:01
Bootstrap 4 additional gutter settings 20px, 10px, 0px
// 20px gutters between collumns
.row.gutter-20 {
margin-right: -10px;
margin-left: -10px;
.row.gutter-20>.col,
.row.gutter-20>[class*="col-"] {
padding-right: 10px;
padding-left: 10px;
}
@kosmala007
kosmala007 / wp-actions.php
Last active December 13, 2020 09:18
Usefull actions for wordpres eg, remove version rom source, remove emojis scripts, enable recaptcha or contact form 7 only on specyfic pages
<?php
/**
* Change default WP login errors message.
*/
add_filter('login_errors', function (): string {
return 'Invalid credentials ¯\_(ツ)_/¯';
});
/**
@kosmala007
kosmala007 / DontLeaveMeAlone.js
Last active February 11, 2020 21:08
Script for prompt before leave form without saving
class DontLeaveMeAlone {
constructor(formElem) {
this.formElem = formElem;
this.formCheckSum = this.getFormCheckSum();
// Events
this.boundBeforeunloadEventHandler = e => this.beforeunloadEventHandler(e);
window.addEventListener('beforeunload', this.boundBeforeunloadEventHandler);
this.formElem.addEventListener('submit', (e) => this.submitEventHandler(e))
abusaidm.html-snippets
bajdzis.vscode-twig-pack
bmewburn.vscode-intelephense-client
cjhowe7.laravel-blade
dakara.transformer
dbaeumer.vscode-eslint
eamodio.gitlens
ecmel.vscode-html-css
ecodes.vscode-phpmd
EditorConfig.EditorConfig
@kosmala007
kosmala007 / vscode-conf.json
Created February 11, 2020 09:28
Vscode usefull settings
{
"editor.renderWhitespace": "all",
"editor.renderControlCharacters": true,
"files.trimTrailingWhitespace": true,
"editor.rulers": [
80,
120
],
"files.eol": "\n",
"editor.wordWrap": "on",
@kosmala007
kosmala007 / update.sh
Last active February 11, 2020 06:59
Script for update symfony (git pull, composer install, doctrine schema update, clear cache, cache busting)
#!/bin/bash
BLUE='\033[0;34m'
NC='\033[0m' # No Color
COMPOSER='php73 -d memory_limit=4G composer.phar'
SF='php73 bin/console'
DOTENV='.env.local'
echo -e "${BLUE}\n---------------------- Git pull ----------------------\n${NC}"
@kosmala007
kosmala007 / .htaccess
Last active August 17, 2020 10:07
Redirect to non www and https
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Symfony redirect to public
# RewriteCond %{REQUEST_URI} !^public
@kosmala007
kosmala007 / curl_mail.sh
Created January 20, 2020 18:52
Send email from bash by curl (UTF-8)
#!/bin/bash
# send email to one recipient (content in var)
# $host - eg. smtp.devpack.pl
# $port - 587
# $user - admin@devpack.pl
# $pass - password
# $recipient - recipient
# $content - message content must hace headers
# $subject - message subject
@kosmala007
kosmala007 / .editorconfig
Last active March 20, 2020 08:24
Editorconfig file compatible with Symfony and PSR
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@kosmala007
kosmala007 / .htaccess
Last active February 11, 2020 06:33
Apache htaccess file organized for performance and security
<IfModule mod_expires.c>
ExpiresActive On
# Data
ExpiresByType text/xml "access plus 1 year"
ExpiresByType text/html "access plus 1 year"
ExpiresByType text/plain "access plus 1 year"
ExpiresByType application/xml "access plus 1 year"
ExpiresByType application/json "access plus 1 year"
ExpiresByType application/rss+xml "access plus 1 year"