Skip to content

Instantly share code, notes, and snippets.

View index0h's full-sized avatar

Roman Levishchenko index0h

View GitHub Profile
@index0h
index0h / examlpe.sh
Created December 30, 2016 16:51
example goroutine
index0h@home-pc:/tmp$ cat test.go
package main
import (
"fmt"
"time"
)
func pinger(c chan string) {
for i := 0; ; i++ {
/**
* ███████████████████████████████████████████████▓▓▓▓▓▀▀▀▓▓▓▓▓▓▓▓▓▓██▓▌█▌▒▓▓▓▓▓▓▓▓
* ██████████████████████▓▄▓████▓▓▓▓██████▓▓█▓▓███████▌▄▄░ ▓▓▓▓▓▓▓██▐▌▓▌▓▓▓▓▓▓▓▓▌
* ██████████████████████▌▄▄▄▄▓▓▓█████▌▀▀▓░▐░ ▓██▀███▓███▌▒▐▄▓▓▓▓▓▓███▓▓█▌▓▓▓▓▓▓▓▓▒
* ██████████████████████████████▓▓▀ ▀▓▓▓▓▄▄▄▓▓▓▓▓███▓▓█ ▓▓▓▓▓▓▓▓▓
* ███████████▀████████████████▀░▒░ ▀█████▓▓▓▓▓██▌███░▓▓▓▓▓▓▓▓▓
* ████████████▐█▓ ███████████▓▒▒░ ░████▓▓▓▓▓████▓▓▌▓▓▓▓▓▌▓▓▓
* ███████████▓▒██ █████████████▓▄ █████▓▓▓▓███▓██ ▓▓▓▓▓▓▓▓▓
* ▓██████████▌▓██ █████████████▓▀░ ▐▀████▌▓▓▓██████░▓▓▓▓▓▓▓▓▌
* ▓███████▓▀▓░▓█▌ █████████████▓▓▓▓▓▓▓▄▓█▓▄▄▄▄▄▄▓▓▓▓▓▓▄▄▓████▓▓▓▓▓███▌▓▄▓▓▓▓▓▓▓▓▓
@index0h
index0h / git-on-windows.md
Created October 10, 2016 16:38
git-on-windows.md

Install on Windows

ATTENTION!!!

If your %HOMEPATH% contains non ASCII symbols, for example cyrillic - it's better to create another user.

Download and install Git

  • Step: Adjusting your PATH environment
@index0h
index0h / apocalypse_good.svg
Created August 10, 2016 08:48
apocalypse_good.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@index0h
index0h / MyRegistrationForm.php
Created June 17, 2016 14:01
MyRegistrationForm.php
<?php
class MyRegistrationForm
{
/** @var string */
private $email;
/** @var string */
private $password;
@index0h
index0h / README.md
Created April 21, 2016 23:27
ansible + docker
vagrant up
vagrant ssh
sudo -i
docker -irt --name CONTAINER_NAME centos:centos6.6 bash
ansible-playbook -i hosts playbook.yml
docker commit $(docker ps -aqf "name=CONTAINER_NAME") CONTAINER_NAME:CONTAINER_VERSION
@index0h
index0h / testAddNeverConstraints.php
Created April 14, 2016 16:45
testAddNeverConstraints.php
<?php
class Test {
protected function verifyMockObjects()
{
$reflectionMockObjectsProperty = new \ReflectionProperty(\PHPUnit_Framework_TestCase::class, 'mockObjects');
$reflectionMockObjectsProperty->setAccessible(true);
$reflectionConfigurableMethods = new \ReflectionProperty(
@index0h
index0h / image_resize.php
Created April 7, 2016 21:28
image_resize.php
<?php
$sourcePath = '';
$destinationPath = '';
$maxHeight = 1024;
$maxWith = 768;
$ratio = $maxWith / $maxHeight;
$dir = new DirectoryIterator($sourcePath);
@index0h
index0h / app-config-services.yml
Last active March 1, 2016 21:10
symfony_example
services:
account_repository:
class: MY\AppBundle\Repository\AccountRepository
factory: ["@doctrine", getRepository]
arguments:
- MY\AppBundle\Entity\Account
@index0h
index0h / report_redmine.js
Last active September 27, 2017 15:45
report_redmine.js
var result = {};
$('.time-entry').each(function () {
var $subject = $(this).children('.subject');
var $tracker = $subject.children('a').text();
var $issue = $subject.contents().last().text().substring(2);
var task = '[' + $tracker.replace(' ', '') + '][' + $issue + ']';
var time = $($(this).children('.issue-hours')[0]).text() * 1;
if (!result.hasOwnProperty(task)) {