Skip to content

Instantly share code, notes, and snippets.

View shov's full-sized avatar
🐊
^^

Alexander Shevchenko shov

🐊
^^
View GitHub Profile
@shov
shov / linked_list
Last active January 30, 2017 13:00
linked list part
class LinkedList {
constructor() {
this.headNode = null;
this.currNode = null;
}
append(data) // метод добавления элемента
{
var newNode = new Node(); // создаём новый элемент
@shov
shov / vkcom_audio_download.py
Created February 2, 2017 09:25 — forked from st4lk/vkcom_audio_download.py
Python: vkontakte.ru (vk.com) audio music downloader
# -*- coding: utf-8 -*-
"""
Скрипт для скачивания музыки с сайта vkontakte.ru (vk.com)
Запуск:
python vkcom_audio_download.py
Принцип работы:
Скрипт проверяет сохраненный access_token. Если его нет или срок истек,
то открывается страница в браузере с запросом на доступ к аккаунту.
<?php
class DB
{
public function burn(string $data)
{
if(empty($data)) throw new \Exception(sprintf("Wrong data, %s given" . PHP_EOL, $data));
echo $data . PHP_EOL;
}
}
@shov
shov / mysqldump_fordate.sh
Last active March 21, 2017 07:35
mysqldump for date
DATE=`date +%Y-%m-%d` && mysqldump -u user_name -p"" db_name > "./db_name-dump-${DATE}.sql"
@shov
shov / linkedInInviter.js
Last active April 13, 2017 13:51
Inviter script for linkedin.com
(function () {
function FriendInviteBot() {
const netUrl = "https://www.linkedin.com/mynetwork/";
var silent = false;
var buttonsList;
var alreadyCollectedUsers = [];
function timeOutDecorator(method, intervalSrc) {
return function () {
@shov
shov / event-controller-1.0.js
Last active April 17, 2017 15:41
Event Controller
(function(global){
function EventController(){
var oEvents = {};
this.doEvent = function(eventname, args) {
if(typeof(eventname) !== 'string') {
return false;
}
if(typeof(oEvents[eventname]) === 'object' && Array.isArray(oEvents[eventname])) {
@shov
shov / removeCR.sh
Last active May 18, 2017 09:28
Remove \r in all .sh in the current directory used tr
#!/bin/bash
function movement() {
local bname=$(basename "$1")
local fbname=${bname%.*}
mv "$1" "${fbname}"
}
find . -name '*.sh' -exec sh -c 'tr -d "\r" < "$0" > "$0.tmp"' '{}' \;
find . -name "*.sh.tmp" | while read file; do movement "$file"; done
@shov
shov / Decorator.php
Last active December 7, 2017 09:19
PHP Implementation of the decorator as the Trait
<?php
/**
* Trait Decorator
*
* Required on host
* @method getDecoratedObject()
*/
trait Decorator
{
@shov
shov / .env
Created January 29, 2018 14:56
Unit test Laravel 5 packages in context with Travis CI (with MySQL testing database)
APP_ENV=testing
APP_DEBUG=true
APP_KEY=RMme3vqJUaNAxVi5kq33xBgRAxmp7yXU
DB_HOST=localhost
DB_DATABASE=test
DB_USERNAME=root
DB_PASSWORD=
CACHE_DRIVER=array
@shov
shov / DecoratorWithStatic.php
Last active February 16, 2018 11:00
PHP Decorator trait. For a while not correct (catch any throwable and means it's error of calling undefined static method
/**
* Trait DecoratorTrait
*
* Have to implemented:
* @method getDecoratedObject()
* @static $decoratedClass
*/
trait DecoratorTrait
{
/**