Skip to content

Instantly share code, notes, and snippets.

View Astargh's full-sized avatar

Andrey Verovkin Astargh

  • Kharkiv, Ukraine
View GitHub Profile
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
@Astargh
Astargh / gist:c3e3dde8e043a0bc1c6614a6d0477f09
Created November 2, 2018 09:32
Random password method
randomPassword(length) {
const chars = 'abcdefghijklmnopqrstuvwxyz!@#$%^&*()-+<>ABCDEFGHIJKLMNOP1234567890';
let pass = '';
for (let x = 0; x < length; x++) {
let i = Math.floor(Math.random() * chars.length);
pass += chars.charAt(i);
}
if (pass.match(/^(?=.*\d)(?=.*[^a-zA-Z\d\s:])(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{8,15}$/g) === null) {
return this.randomPassword(length);
@Astargh
Astargh / SQL
Created March 3, 2017 09:28
Команда в SQL для переноса WP на другой домен
UPDATE wp_options SET option_value = replace(option_value, 'http://domain.ru', 'http://newdomain.ru') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://domain.ru','http://newdomain.ru');
UPDATE wp_posts SET post_content = replace(post_content, 'http://domain.ru', 'http://newdomain.ru');
@Astargh
Astargh / input-number.js
Created February 22, 2017 22:44
Input + - woocommerce
$(document).on('click', '.jckqv-qty-spinner', function () {
var $the_button = $(this),
$catalog = $the_button.parents('.catbox'),
$price = $catalog.find('.amount').attr('data-price-span'),
$pricePrev = $the_button.parents('.single_variation_wrap').find('.amount').attr('data-price-val'),
$qty_wrapper = $the_button.closest('.quantity'),
$qty_field = $qty_wrapper.find('.qty'),
dir = $the_button.attr('data-dir');
@Astargh
Astargh / function.php
Created February 22, 2017 22:41
Quick view woocommerce
wp_enqueue_script( 'my-ajax-request', get_template_directory_uri() . '/js/main.js' );
wp_localize_script( 'my-ajax-request', 'myajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
add_action('wp_ajax_woo_quickview', 'woo_quickview');
add_action('wp_ajax_nopriv_woo_quickview', 'woo_quickview');
function woo_quickview() {
global $post, $product, $woocommerce;
@Astargh
Astargh / e-mail-send.js
Created February 22, 2017 22:32
E-mail Ajax Send
//E-mail Ajax Send
$("form").submit(function() { //Change
var th = $(this);
$.ajax({
type: "POST",
url: "mail.php", //Change
data: th.serialize()
}).done(function() {
setTimeout(function() {
var lastId,
topMenu = $('.header-min'),
topMenuHeight = topMenu.outerHeight() + 50;
// All list items
var menuItems = topMenu.find("a"),
// Anchors corresponding to menu items
scrollItems = menuItems.map(function() {
var item = $($(this).attr("href"));
if (item.length) {