Skip to content

Instantly share code, notes, and snippets.

@errogaht
errogaht / jira-copy-task.js
Last active January 14, 2019 16:04 — forked from comm1x/jira-copy-task.js
Add button "Copy task name" to JIRA (version for suxx new JIRA interface)
// ==UserScript==
// @name Copy jira task name
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://kafoodle.atlassian.net/browse/*
// @grant none
// ==/UserScript==
<?php
/// renames iOS Evernote files names from Evernote Snapshot 20180502 203934.png ; Evernote Snapshot 20180502 203934 [2].png
/// to android filename style: img_20180502_203934.1.png, img_20180502_203934.2.png
$a = [];
foreach (glob('*.png') as $path) {
preg_match('/(Evernote Snapshot )(\d+) (\d+)\s?(\[\d+\])?/', $path, $matches);
$suffix = $matches[4] ?? null;
$suffix = $suffix ? (int)trim($suffix, '[]') : 1;
$newName = "img_{$matches[2]}_{$matches[3]}.$suffix.png";
rename($path, $newName);
@errogaht
errogaht / backup.sh
Created December 16, 2016 05:17
backup mysql + files to FTP
site_name="site.ru"
path_to_site="/home/admin/web/site.ru/public_html"
path_for_backups="/home/admin/web/site.ru/backups_tmp"
db_name="don_tur"
db_user="don_tur"
#db_passsword=
db_host="localhost"
ftp_login=""
ftp_pass=""
ftp_host=""
<?php
$x = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
function recursiveCompact($array, $value)
{
$arrayDeeper = function (&$arr, $value) use (&$arrayDeeper) {
$last = array_pop($arr);
$return = [$last => $value];
@errogaht
errogaht / centos-7-php7
Created January 10, 2016 12:26
cent os 7 php 7 build
yum group install "Development Tools"
yum group install "Development Libraries"
yum install libxml2-devel openssl-devel git autoconf gcc bison bzip2-devel curl-devel libjpeg-devel freetype-devel libmcrypt libmcrypt-devel mhash \
mhash-devel php-mysql mysql-devel aspell-devel libtidy libtidy-devel libxslt libxslt-devel glibc-utils libtool-ltdl-devel libpng-devel db4-devel libXpm-devel \
gmp-devel libc-client-devel openldap-devel unixODBC-devel postgresql-devel sqlite-devel net-snmp-devel pcre-devel t1lib-devel recode-devel expat-devel
./configure \
--prefix=/opt/php70 \
--with-config-file-path=/opt/php70/etc \
--with-config-file-scan-dir=/opt/php70/etc/php.d \
--with-libdir=lib64 \
@errogaht
errogaht / js-patterns.js
Created December 21, 2015 05:36
4 JavaScript Design Patterns You Should Know by Devan Patel (@devanp92)
/**
* 1. Module Design Pattern
* @link https://scotch.io/bar-talk/4-javascript-design-patterns-you-should-know#module-design-pattern
*/
(function () {
// declare private variables and/or functions
return {
@errogaht
errogaht / common-height.js
Last active January 11, 2016 17:35
JavaScript Common css height for child elements
/**
* Common height for all .common-height__item placed inside parent wrapper
* with .common-height selector
*
* Example:
*
* <div class="common-height">
* <div class="common-height__item"></div>
* <div class="common-height__item"></div>
* <div class="common-height__item"></div>
@errogaht
errogaht / test.php
Created November 23, 2015 16:24
test.php
<?php
require_once("vendor/autoload.php");
$code = file_get_contents('settings.php');
$settings = [];
$parser = new PhpParser\Parser(new PhpParser\Lexer\Emulative);
@errogaht
errogaht / ubuntu_phpstorm_fixes
Created November 12, 2015 08:48
ubuntu_phpstorm_fixes
http://onedev.net/post/469
@errogaht
errogaht / useful_css_classes.css
Created September 9, 2015 09:29
Useful css classes
/*
* Clearfix: contain floats
*
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* `contenteditable` attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that receive the `clearfix` class.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.