Skip to content

Instantly share code, notes, and snippets.

View abler98's full-sized avatar
🇺🇦
Все буде Україна!

Serhii Semenko abler98

🇺🇦
Все буде Україна!
  • Ukraine, Kharkiv
View GitHub Profile
const TOP = 'top';
const BOTTOM = 'bottom';
const LEFT = 'left';
const RIGHT = 'right';
const OUTSIDE = 'outside';
const INSIDE = 'inside';
const SIDES = [TOP, RIGHT, BOTTOM, LEFT];
const SIDES_LENGTH = SIDES.length;
package com.example;
import java.util.*;
import java.util.logging.Logger;
import java.util.regex.Pattern;
public class Main {
// Use control characters for minimize chance of matches with original text
private static final String UGLY_HACK_MARKER = "\u0080\u0081\u0082";
@abler98
abler98 / IntString.php
Created August 16, 2018 10:08
Simple istr encoder/decoder
<?php
class IntString
{
/**
* Набор символов для кодирования
*/
const CHARSET = '0-9a-zA-Z_-';
/**
@abler98
abler98 / ubuntu-php7.2-zts-pthreads
Created October 12, 2017 20:21 — forked from 0xfff/ubuntu-php7.2-zts-pthreads
Installing php-zts on ubuntu 16.04
#####################################################################################
# INSTALL isolated PHP 7.2 ZTS (Thread-safe) with pthreads on Ubuntu 14.04 &16.04 ###
#####################################################################################
0) Possible dependencies
sudo apt-get install libxml2-dev
1) Install necessary bison version
wget http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb
@abler98
abler98 / ngram-search.sh
Created August 4, 2017 18:15 — forked from avar/ngram-search.sh
ElasticSearch fuzzy ngram powered search
export http_proxy=
export https_proxy=
curl -XDELETE 'http://localhost:9200/test/'
echo "Creating the mapping"
curl -XPUT 'http://localhost:9200/test/?pretty=1' -d '
{
"mappings" : {
"member" : {
@abler98
abler98 / movie-titles.rb
Created August 3, 2017 09:29 — forked from karmi/movie-titles.rb
Multiple analyzers and query fields in Elasticsearch for auto-completion
require 'tire'
# Tire.configure { logger STDERR, level: 'debug' }
Tire.index('movie-titles') do
delete
create \
settings: {
index: {
analysis: {
@abler98
abler98 / vk-audio-downloader.js
Last active November 15, 2024 19:19
Скрипт для скачивания музыки VK
/*
Инструкция по использованию:
- заходим в раздел с аудиозаписями
- листаем в самый низ (чтобы прогрузились все аудиозаписи)
- открываем консоль браузера (F12 -> Консоль)
- вставляем код и нажимаем ENTER
- скачивание началось...
- браузер может потребовать разрешение на сохранение файлов, необходимо подтвердить действие
@abler98
abler98 / AbstractPresenter.php
Created January 13, 2017 10:24 — forked from Ellrion/AbstractPresenter.php
Презентеры в Laravel.
<?php
namespace App\Presenters;
abstract class AbstractPresenter
{
/**
* The resource that is the object that was decorated.
*
* @var mixed
<?php
function hex2rgb($color = '#fff')
{
$color = ltrim($color, '#');
$length = strlen($color);
if (preg_match('/[^0-9a-f]/i', $color) or $length <> 3 && $length <> 6) {
throw new Exception('Invalid color format');
}
<?php
namespace App\Models;
use Illuminate\Http\Exception\HttpResponseException;
use Illuminate\Http\UploadedFile;
use Intervention\Image\Constraint;
use Intervention\Image\Exception\NotWritableException;
class Photo extends \Eloquent