Skip to content

Instantly share code, notes, and snippets.

View maynagashev's full-sized avatar
👨‍💻
Go

Evgeniy Maynagashev maynagashev

👨‍💻
Go
View GitHub Profile
@maynagashev
maynagashev / parse-stock-keys-from-desc.php
Last active October 31, 2016 08:51
Prepares keywords for photo stock web sites: Shutterstock.com, iStockPhoto.com, Fotolia.com etc. Simple PHP parser script.
<?php
/*
From a plain text/description of photo, makes list of keywords, separated with comma, filtering articles and prepositions.
Example:
INPUT: Portrait of a happy bald man photographer with professional digital camera on his neck, he throws tons
of leaves falling in the air in autumn park, enjoying the sunshine weather, glad and satisfied.
OUTPUT: portrait, happy, bald, man, photographer, professional, digital, camera, neck, throws, tons, leaves, falling, air, autumn, park, enjoying, sunshine, weather, glad, satisfied
*/
$exclude = array(
'in', 'a', 'or', 'the', 'in', 'with', 'an', 'at', 'on', 'from', 'and', 'to', 'of', 'is', 'her', 'his', 'he', 'she', 'it'
@maynagashev
maynagashev / log.js
Last active November 12, 2016 13:40
Console.log redefine
window.log = function() {
try {
return console.log.apply(console, arguments);
} catch (_error) {}
};
// OR
window.log = function() { return console.log.apply(console, arguments); };
@maynagashev
maynagashev / angular_pagination.js
Created November 15, 2016 13:06
Angular Simplest Pagination
var perPage = 10;
var items = [];
// init call
$scope.pagination = pagination(items, perPage, 1);
// subsequent calls (usually a method inside controller for ng-click)
this.showPage = function (page) {
$scope.pagination = pagination($scope.pagination.items, perPage, page);
};
@maynagashev
maynagashev / spacing-.css
Last active February 7, 2018 16:43
Bootstrap 4 spacing
/* top */
.p-t-0 { padding-top: 0px; }
.p-t-1 { padding-top: 10px; }
.p-t-2 { padding-top: 15px; }
.p-t-3 { padding-top: 30px; }
/* bottom */
.p-b-0 { padding-bottom: 0px; }
.p-b-1 { padding-bottom: 10px; }
.p-b-2 { padding-bottom: 15px; }
@maynagashev
maynagashev / .env
Last active January 7, 2021 08:37
Socialite providers .ENV boilerplate records forked from https://github.com/jeremykenedy/laravel-auth
# https://www.google.com/recaptcha/admin#list
RE_CAP_SITE=YOURGOOGLECAPTCHAsitekeyHERE
RE_CAP_SECRET=YOURGOOGLECAPTCHAsecretHERE
# https://vk.com/apps?act=manage
VKONTAKTE_KEY=your_vk_app_id
VKONTAKTE_SECRET=your_vk_app_secret
VKONTAKTE_REDIRECT_URI=http://yourwebsiteURLhere.com/social/handle/vkontakte
# https://developers.facebook.com/
@maynagashev
maynagashev / SmoothData.php
Created March 13, 2017 06:04
SmoothData slow versions with Laravel collections
// Other versions
/**
* Smooth by Moving Average algorithm with prevData measurements data (optional)
* ----------------------------
* USING COLLECTIONS VERY SLOW!
* ----------------------------
* @param $data
* @param $len
@maynagashev
maynagashev / list.blade.php
Created March 26, 2017 16:41
Load more jquery function
<div class="wrapper tiles">
@foreach($articles as $d)
{{$d->title}}
<input type="hidden" class="article-id" name="article-id" value="{{$d->id}">
@endforeach
</div>
@maynagashev
maynagashev / __call
Last active March 31, 2017 11:06
Magic methods PHP __get/__set/__call
class pinbaWrapper {
private $pinbaEnabled;
public function __construct() {
$this->pinbaEnabled = extension_loaded('pinba');
}
public function __call($name, $arguments) {
if (!$this->pinbaEnabled) return false;
@maynagashev
maynagashev / display_errors.php
Created March 31, 2017 08:15
PHP display errors
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
@maynagashev
maynagashev / so-active-filter.js
Created April 21, 2017 16:56
Shared Object with History tracking methods
/**
* Created by maynagashev on 21.04.17.
*/
/**
* Shared Object for storing current Active Filter settings, used in:
* @components: moments-list, filter-bar, load-more
*
* + historyAPI (write and read new status)
*