Skip to content

Instantly share code, notes, and snippets.

View slava-konashkov's full-sized avatar
🏠
Working from home

Viacheslav Konashkov slava-konashkov

🏠
Working from home
View GitHub Profile
<?php
$arr = [
'a' => 1,
'b' => [
'c' => 2,
'd' => 3
],
'e' => [
'f' => [
'g' => 4,
<?php
class Users implements ArrayAccess, Countable {
private $users = [];
public function __toString() {
return 'Total users: ' . $this->count() . PHP_EOL;
}
public function count() : int {
<?php
class Invoker {
private $args = [];
function __invoke($a) {
if (is_callable($a)) {
$result = array_shift($this->args);
foreach ($this->args as $arg) {
@slava-konashkov
slava-konashkov / GIF-Screencast-OSX.md
Created April 17, 2020 08:51 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@slava-konashkov
slava-konashkov / ruleset.xml
Created December 18, 2019 10:31 — forked from gsherwood/ruleset.xml
PSR2 with tabs instead of spaces
<?xml version="1.0"?>
<ruleset name="MyStandard">
<description>PSR2 with tabs instead of spaces.</description>
<arg name="tab-width" value="4"/>
<rule ref="PSR2">
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
</rule>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
@slava-konashkov
slava-konashkov / ubuntu_agnoster_install.md
Created February 15, 2019 14:19 — forked from renshuki/ubuntu_agnoster_install.md
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@slava-konashkov
slava-konashkov / iterm2-solarized.md
Created February 15, 2019 06:22 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@slava-konashkov
slava-konashkov / zip_stream_big_files.php
Last active September 26, 2018 14:53
Zip Stream big files
<?php
$files = array("testFiles/1.jpg", "testFiles/2.jpg", "testFiles/3.jpg");
//Getting the total size of the files array
$totalSize = 0;
foreach ($files as $file) {
$totalSize += filesize($file);
}
$totalSize += 300; //I don't understand why, but the totalSize is always 300kb short of the correct size
@slava-konashkov
slava-konashkov / fork-update.md
Last active August 10, 2018 22:12
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@slava-konashkov
slava-konashkov / libimobiledevice_ifuse_Ubuntu.md
Created September 6, 2017 06:58 — forked from samrocketman/libimobiledevice_ifuse_Ubuntu.md
On Ubuntu 16.04, since iOS 10 update, libimobiledevice can't connect to my iPhone. This is my attempt to document a fix.

Why this document?

I upgraded my iPhone 5s to iOS 10 and could no longer retrieve photos from it. This was unacceptable for me so I worked at achieving retrieving my photos. This document is my story (on Ubuntu 16.04).

The solution is to compile libimobiledevice and ifuse from source.

Audience

Who is this guide intended for?