Skip to content

Instantly share code, notes, and snippets.

View unnamedfeeling's full-sized avatar

Oleksandr Yarosh unnamedfeeling

View GitHub Profile
@unnamedfeeling
unnamedfeeling / Wrapper.php
Created May 13, 2020 14:58 — forked from krisanalfa/Wrapper.php
Tiny Guzzle Wrapper
<?php
namespace Alpha;
use GuzzleHttp\Client;
class Wrapper
{
protected static $client;
@unnamedfeeling
unnamedfeeling / wc_order_status_changes.php
Created September 6, 2019 14:51 — forked from abegit/wc_order_status_changes.php
WooCommerce Hooks for Order Status Changes
function mysite_pending($order_id) {
error_log("$order_id set to PENDING", 0);
}
function mysite_failed($order_id) {
error_log("$order_id set to FAILED", 0);
}
function mysite_hold($order_id) {
error_log("$order_id set to ON HOLD", 0);
}
function mysite_processing($order_id) {
@unnamedfeeling
unnamedfeeling / strtr.js
Created May 17, 2019 11:26 — forked from dsheiko/strtr.js
Java-script strtr — translate characters or replace substrings
/**
* strtr() for JavaScript
* Translate characters or replace substrings
*
* @author Dmitry Sheiko
* @version strtr.js, v 1.0.1
* @license MIT
* @copyright (c) Dmitry Sheiko http://dsheiko.com
**/
@unnamedfeeling
unnamedfeeling / what-forces-layout.md
Created August 21, 2018 11:05 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@unnamedfeeling
unnamedfeeling / backup.sh
Created August 20, 2018 07:47 — forked from arunk-s/backup.sh
Shell Script for taking Incremental Backup and store it at a remote place
# backup.sh
# The contents of this file are released under the GNU General Public License. Feel free to reuse the contents of this work, as long as the resultant works give proper attribution and are made publicly available under the GNU General Public License.
# By Arun Sori <arunsori94@gmail.com>
#For taking backup of the desired directory and store it at a remote place
#timestamp
time_stamp=`date`
#backup file name
@unnamedfeeling
unnamedfeeling / regex.js
Created August 4, 2018 19:48 — forked from Integralist/regex.js
The difference between JavaScript's `exec` and `match` methods is subtle but important, and I always forget...
var str = "The quick brown fox jumped over the box like an ox with a sox in its mouth";
str.match(/\w(ox)/g); // ["fox", "box", "sox"]
// match (when used with a 'g' flag) returns an Array with all matches found
// if you don't use the 'g' flag then it acts the same as the 'exec' method.
str.match(/\w(ox)/); // ["fox", "ox"]
/\w(ox)/.exec(str); // ["fox", "ox"]
@unnamedfeeling
unnamedfeeling / iterator.php
Created July 26, 2018 14:45 — forked from ckhampus/iterator.php
PHP Parent Array Iterator
<?php
$data = array(
array(
'id' => 1,
'children' => array(
array(
'id' => 12,
'children' => array(
<!--
Email template: student/purchase_notification
Description: This email is sent to a student when they enroll in a course.
-->
<!-- Email Title -->
<div class="header-title">
<h1>{{text.email_receipts.thank_you_for_enrolling_in }} {{sale.course.name }}</h1>
</div>
@unnamedfeeling
unnamedfeeling / watchdog.sh
Created May 7, 2018 07:18 — forked from vodolaz095/watchdog.sh
watchdog.sh script for checking server running not mine, i stole it)
#!/bin/bash
# Service watchdog script
# Put in crontab to automatially restart services (and optionally email you) if they die for some reason.
# Note: You need to run this as root otherwise you won't be able to restart services.
#
# Example crontab usage:
#
# Strict check for apache2 service every 5 minutes, pipe results to /dev/null
# */5 * * * * sh /root/watchdog.sh apache2 "" > /dev/null
#
@unnamedfeeling
unnamedfeeling / deploy_zoneminder.sh
Created April 2, 2018 16:24 — forked from g3rhard/deploy_zoneminder.sh
Install ZoneMinder with h264 archive storage
#!/bin/bash
# http://zoneminder.readthedocs.io/en/latest/installationguide/ubuntu.html#easy-way-ubuntu-16-04
#Задаем пароль для пользователя root для MySQL
COOKIES_PASSWORD="PASSWORD"
#Задаем часовой пояс для PHP
TIMEZONE="Asia/Irkutsk"
# Настраививаем автоматический ввод пароля для админа mysql.