Skip to content

Instantly share code, notes, and snippets.

View peacefulseeker's full-sized avatar

Alexey Vorobyov peacefulseeker

  • Riga
View GitHub Profile
@peacefulseeker
peacefulseeker / jquery-javsacript.html
Last active January 5, 2018 11:41
jQuery - Javascript Equivalents
<script type="text/javascript">
/* jQuery code */
(function($) {
$(function() {
var $ihRedirect = $("#myModal input[id$='groupon_redirect_url']");
$("[data-target='#myModal']").click(function(e) {
e.preventDefault();
@peacefulseeker
peacefulseeker / jquery-fallback.html
Created December 20, 2017 09:31
jQuery CDN to Local Fallback
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/js/jquery-2.1.1.min.js"></script>')</script>
@peacefulseeker
peacefulseeker / git-unstage-and-keep-locally
Created December 5, 2017 15:37
Git - make modified files unstaged and keep them locally. Symlink solution even when they are in .gitignore
git update-index --assume-unchanged desktop/assets
git update-index --assume-unchanged desktop/static
@peacefulseeker
peacefulseeker / git_commands.txt
Last active March 6, 2018 09:11
Useful Git Commands
// Set remote origin connection
git remote add origin ssh://git@git.datenmarkt.de:a.vorobjovs/Pflegegradrechner.git
// Get remote URL
git config --get remote.origin.url
// Clone in current empty directory
git clone git@git.datenmarkt.de:a.vorobjovs/Pflegegradrechner.git .
// Switch branch
@peacefulseeker
peacefulseeker / detect_ie11.js
Created November 24, 2017 15:24
jQuery - Detect MSIE 11
if ( !(window.ActiveXObject) && "ActiveXObject" in window ) {
/* IE 11*/
$("html").addClass('MSIE MSIE11');
}
@peacefulseeker
peacefulseeker / .htaccess_redirect_root_to_subfolder
Created November 22, 2017 09:53
Htaccess - Redirect WordPress root to a subfolder
# Redirecting root to subfolder /ccds/
RedirectMatch ^/$ /ccds/
@peacefulseeker
peacefulseeker / .htaccess_force_https_only
Created September 19, 2017 10:19
Htaccess force HTTPS only
# Force HTTPS redirection
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
@peacefulseeker
peacefulseeker / wp-disable-emojis.php
Created September 8, 2017 09:21
WordPress - Disable Emojis
/**
* Disable the emoji's
*/
function disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
@peacefulseeker
peacefulseeker / robots.txt_deny_all
Last active November 27, 2017 16:20
Robots.txt - NoIndex All
User-agent: *
Disallow: /
@peacefulseeker
peacefulseeker / functions.php_autooptimize_clear_caches
Last active April 22, 2019 09:40
WordPress - Autooptimize Plugin Clear Cache automatically
# Automatically clear autoptimizeCache if it goes beyond 256MB
if (class_exists('autoptimizeCache')) {
$myMaxSize = 256000; # You may change this value to lower like 100000 for 100MB if you have limited server space
$statArr=autoptimizeCache::stats();
$cacheSize=round($statArr[1]/1024);
if ($cacheSize>$myMaxSize){
autoptimizeCache::clearall();
header("Refresh:0"); # Refresh the page so that autoptimize can create new cache files and it does breaks the page after clearall.
}