Skip to content

Instantly share code, notes, and snippets.

View atamaniuc's full-sized avatar
🏠
Working from home

Dmitriy Atamaniuc atamaniuc

🏠
Working from home
  • Chisinau, Republic of Moldova
View GitHub Profile

Keybase proof

I hereby claim:

  • I am atamaniuc on github.
  • I am datamaniuc (https://keybase.io/datamaniuc) on keybase.
  • I have a public key ASDDnINGEobpCSexj1uSOsHaGOFg2XekE6rW5XzPKXqPawo

To claim this, I am signing this object:

1. Install oh-my-zsh
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
2. Clone necessary plugins.
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
3. Add plugins to ~/.zshrc as
plugins = ( [plugins...] zsh-autosuggestions zsh-history-substring-search zsh-syntax-highlighting)
@atamaniuc
atamaniuc / remove-array-multi-dem-duplicates.js
Created May 8, 2020 14:14
Removing Duplicate Arrays from an Array of Arrays
let bigArray = [["a", "b", "c"],
[1, 2, 3],
[true, true, false],
[":)", ":P", ":X"],
[true, false, false],
[1, 2, 3],
["foo", "zorb", "blarg"],
["a", "b", "c"]];
let uniqueArray = Array.from(new Set(bigArray.map(JSON.stringify)), JSON.parse);
(function ($) {
/**
* @function
* @property {object} jQuery plugin which runs handler function once specified element is inserted into the DOM
* @param {function} handler A function to execute at the time when the element is inserted
* @param {bool} shouldRunHandlerOnce Optional: if true, handler is unbound after its first invocation
* @example $(selector).waitUntilExists(function);
*/
<?php
function my_backup_scheduler( $event ) {
// 'wp_maybe_auto_update' is the cron hook for the auto update process
if ( 'wp_maybe_auto_update' !== $event['hook'] )
return;
wp_schedule_single_event( $event['timestamp'] - 5 * MINUTE_IN_SECONDS, 'my_backup' );
}
add_filter( 'schedule_event', 'my_backup_scheduler', 10, 1 );
<?php
/*
* Plugin Name: Commercial Client
* Plugin URI: http://pento.net/
* Description: A sample client plugin for showing updates for non-WordPress.org plugins
* Author: pento
* Version: 0.1
* Author URI: http://pento.net/
* License: GPL2+
*/