Skip to content

Instantly share code, notes, and snippets.

View reatlat's full-sized avatar
🍋
Life gave me lemons, I forked.

Alex Zappa reatlat

🍋
Life gave me lemons, I forked.
View GitHub Profile
@reatlat
reatlat / jquery.donetyping.js
Created April 7, 2019 01:22
Jquery custom event handler , triggers when user stop typing.
/*
* $('#element').donetyping(callback[, timeout=1000])
*
* source: http://stackoverflow.com/a/14042239/3705299
*
* Fires callback when a user has finished typing. This is determined by the time elapsed
* @callback: function to be called when even triggers
* @timeout: (default=1000) timeout, in ms, to to wait before triggering event if not caused by blur.
* Requires jQuery 1.7+
* Tested with jQuery 1.11.3
<script type="text/javascript">
// Original idea taken here
// @link https://community.unbounce.com/t/require-business-email-address/14158
(function () {
// set interval to check if jQuery loaded
var int_jQuery = setInterval(function () {
// add additional metood for check free emails
if (typeof lp.jQuery === "function") {
// clear interval for jQuery becoase lp.jQuery already loaded
clearInterval(int_jQuery);
@reatlat
reatlat / nyan-cat-console.js
Created March 17, 2019 03:09 — forked from rdlh/nyan-cat-console.js
Get the NYAN CAT in your developer console !
var _nyan = 0;
var __nyan = [[
"+ o + o ",
" + o + + ",
"o + ",
" o + + + ",
"+ o o + o ",
"-_-_-_-_-_-_-_,------, o ",
"_-_-_-_-_-_-_-| /\\_/\\ ",
"-_-_-_-_-_-_-~|__( ^ .^) + + ",
@reatlat
reatlat / replace-user-agent.js
Created March 13, 2019 21:55
Replace userAgent to new one
// UserAgent == iPhone6
Object.defineProperty(navigator, 'userAgent', {
get: function () { return 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25'; }
});
@reatlat
reatlat / assets.conf
Last active March 11, 2019 22:27
Nginx config for WP Fastest Cache
# Set expires for static files
# Note to self (and to anyone forks it)
# Some sites create robots.txt and sitemap(.xml(.gz)) files on the fly
# If you are sure that they are indeed static, uncomment the following location blocks for each and adject the expires headers to fit your site's needs
# location = /robots.txt { expires 1d; log_not_found off; access_log off; }
# location ~ \.xml(\.gz)?$ { expires 600s; log_not_found off; access_log off; }
# For CSS / JS
location ~ \.(?:css|js)$ {
server {
...
# Include RankMath redirects config to your NGINX server config
include /path-to-public_html/rankmath_redirects.conf*;
...
}
@reatlat
reatlat / page-markup-and-formatting.hml
Created February 21, 2019 16:08
Page Markup And Formatting
<h2>Headings</h2>
<h1>Header one</h1>
<h2>Header two</h2>
<h3>Header three</h3>
<h4>Header four</h4>
<h5>Header five</h5>
<h6>Header six</h6>
<h2>Blockquotes</h2>
Single line blockquote:
<blockquote>Stay hungry. Stay foolish.</blockquote>
#!/bin/bash
images=$(identify -format '%f\n' * 2>/dev/null)
IFS=$'\n'
set -e
max_dims=$(
identify -format '%w %h\n' $images 2>/dev/null |
awk '($1>w){w=$1} ($2>h){h=$2} END{print w"x"h}'
@reatlat
reatlat / vestacp_changeport.md
Last active November 27, 2018 18:09
After updating server via SSH how to change VestaCP port and add firewall rules I run a web host that uses VestaCP as a backbone API for managing resources only, but everything has been patched and wanted to share a script to update your VestaCP port from 8083 to 5600. But only do this AFTER update and patch. It will create the firewall rule on …
@reatlat
reatlat / webstoemp-gulpfile.js
Created November 11, 2018 22:11 — forked from jeromecoupe/webstoemp-gulpfile.js
Gulp 4 sample gulpfile.js
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");