Skip to content

Instantly share code, notes, and snippets.

View teslitsky's full-sized avatar
🎯
Focusing

Dmytro Teslytskyi teslitsky

🎯
Focusing
View GitHub Profile
@teslitsky
teslitsky / leagues.json
Created March 14, 2019 08:35
Football leagues list
{
"data": [
{
"id": 2,
"legacy_id": 11,
"country_id": 41,
"logo_path": "https:\/\/cdn.sportmonks.com\/images\/soccer\/leagues\/2.png",
"name": "Champions League",
"is_cup": true,
"current_season_id": 12950,
@teslitsky
teslitsky / coordinate.json
Created October 24, 2017 09:24
gps_test_task
{
"lat": "-85.6",
"lng: "130.2111111",
"speed": 15.1,
"bearing": 125,
"altitude": 118,
"battery": 98,
"sattelite": 5
}
function drawNestedSetsTree(data, node) {
if (!data || !data.length) {
return false;
}
const ul = document.createElement('ul');
data.sort((a, b) => (a.left - b.left));
data.forEach((item) => {
if (!item.title) {
@teslitsky
teslitsky / mpdo.php
Created November 20, 2014 20:01
OpenCart PDO Database Adapter
<?php
/**
* i changed class name as mPDO because, give me an error
*
* " Fatal error: Cannot redeclare class pdo. If this code worked without the Zend Optimizer+,
* please set zend_optimizerplus.dups_fix=1 in your php.ini "
*/
class Mpdo
{
<?php
/**
* Итератор возвращает набор значений начального итератора
*/
class PartialIterator implements \Iterator
{
/**
* @var int Текущая позиция итератора
*/
@teslitsky
teslitsky / transformation.php
Created August 28, 2013 13:00
Image perspective transformation with Imagick
<?php
/* Main image part */
$main = new Imagick(DIR_IMAGE . $old_image);
$main->setImageMatte(true);
$main->cropimage($main->getImageWidth() * 0.9, $main->getImageHeight(), $main->getImageWidth() * 0.1, 0);
$main->setimagebackgroundcolor("#ffffff");
$main->setImageVirtualPixelMethod(imagick::VIRTUALPIXELMETHOD_BACKGROUND);
$pointsMain = array(
0, 0, 0, 0,
@teslitsky
teslitsky / sms_sending.php
Created January 29, 2013 12:53
Correct version sms_sending SMS gateway for OpenCart with addtional phone numbers.
<?php
final class sms_sending extends SmsGate {
private $url = 'http://lcab.sms-sending.ru/API/XML/send.php';
private function GetPageByUrl($headers, $post_body) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->url); // урл страницы
curl_setopt($ch, CURLOPT_FAILONERROR, 1);