Skip to content

Instantly share code, notes, and snippets.

View peacefulseeker's full-sized avatar

Alexey Vorobyov peacefulseeker

View GitHub Profile
@peacefulseeker
peacefulseeker / .htaccess_wp_memory_limit_curl_timout
Last active November 27, 2017 16:19
WordPress - wp-config.php define WordPress Memory Limit and cURL Temout
/* WordPress Memory Limit */
define('WP_MEMORY_LIMIT', '256M');
/* cURL Timeout */
ini_set('default_socket_timeout', '300');
@peacefulseeker
peacefulseeker / SQL_replace-data-sql-query-wordpress.sql
Last active November 27, 2017 16:24
WordPress - Replace data within WordPress Database
-- Define the repeating string to replace in database table, as well as the string that should be replaced by.
-- SET @what_to_be_replaced = "http://dev.sehner.international", @to_be_replaced_by = "https://sehner.international";
SET @what_to_be_replaced = "https://www.pflegemarkt.com", @to_be_replaced_by = "http://dev.pflegemarkt.com";
-- Update every table columns that usually contains wrong domain(local development or dev version of website)
-- You should provide collation of table as well for the following tables, otherwiser it will throw the error, usually it is COLLATE utf8mb4_general_ci.
-- THESE ARE DEFAULT TABLES OF WORDPRESS
UPDATE pm_commentmeta SET meta_value = REPLACE(meta_value, @what_to_be_replaced, @to_be_replaced_by );
UPDATE pm_comments SET comment_content = REPLACE(comment_content, @what_to_be_replaced ,@to_be_replaced_by);
@peacefulseeker
peacefulseeker / jQuery_scrollToElement.js
Last active November 27, 2017 16:09
jQuery - Smooth Scrolling to Element
(function($) {
$("a[href^='#']")
.not('[href="#"]')
.not('[href="#0"]')
.on('click', function ( event ) {
event.preventDefault();
var $scrollTarget = $( $(this).attr('href') );
$scrollTarget = $scrollTarget.length ? $scrollTarget : $('[name="' + $(this).attr('href').slice(1) + '"]');
/* If not found stop execution */
if ( !$scrollTarget.length ) return;
@peacefulseeker
peacefulseeker / jQuery_gcSmoothScroll.js
Last active November 27, 2017 15:48
jQuery - Google Chrome Smooth Scrolling
/* One line script, that is responsible for google chrome detection and adding smooting to it's scroll */
(function(e){e.extend({browserSelector:function(){var e=navigator.userAgent,t=e.toLowerCase(),n=function(e){return t.indexOf(e)>-1},r="gecko",i="webkit",s="safari",o="opera",u=document.documentElement,a=[!/opera|webtv/i.test(t)&&/msie\s(\d)/.test(t)?"ie ie"+parseFloat(navigator.appVersion.split("MSIE")[1]):n("firefox/2")?r+" ff2":n("firefox/3.5")?r+" ff3 ff3_5":n("firefox/3")?r+" ff3":n("gecko/")?r:n("opera")?o+(/version\/(\d+)/.test(t)?" "+o+RegExp.jQuery1:/opera(\s|\/)(\d+)/.test(t)?" "+o+RegExp.jQuery2:""):n("konqueror")?"konqueror":n("chrome")?i+" chrome":n("iron")?i+" iron":n("applewebkit/")?i+" "+s+(/version\/(\d+)/.test(t)?" "+s+RegExp.jQuery1:""):n("mozilla/")?r:"",n("j2me")?"mobile":n("iphone")?"iphone":n("ipod")?"ipod":n("mac")?"mac":n("darwin")?"mac":n("webtv")?"webtv":n("win")?"win":n("freebsd")?"freebsd":n("x11")||n("linux")?"linux":"","js"];c=a.join(" ");u.className+=" "+c}})})(jQuery);(func
@peacefulseeker
peacefulseeker / jQuery_copyOnClick.js
Last active November 27, 2017 15:48
jQuery - Copy with JS on element click(Works well for pre + code tags)
/* Works well on pre + code tags. */
function copySelected() {
return document.execCommand('copy');
}
$("#element").on("click", function () {
setTimeout(function (argument) {
copySelected();
}, 100);
});