Skip to content

Instantly share code, notes, and snippets.

View SerafimArts's full-sized avatar
wazzup?

Kirill Nesmeyanov SerafimArts

wazzup?
View GitHub Profile
@SerafimArts
SerafimArts / gist:f6538436bd5b6cc7f00b
Last active February 21, 2016 19:57
Яндекс: Задача на собеседование №2
/**
* Вменяемый код
*
* Функция предоставляет вменяемый и расшираемый интерфейс
* для работы с требуемой функцией.
*
* Плюс такого подхода в чистоте кода и возможности
* для будущей поддержки без извращений (например
* логгирование, всякие другие плюшки, в том числе наследоваться).
*
@SerafimArts
SerafimArts / gist:915dc8509f9cd6b9b612
Last active February 21, 2016 19:57
Яндекс: Задача на собеседование №3
/**
* Это феерическое безумие и полный разрыв
* мозга, по-этому я откомментирую ключевые моменты.
*
* Алгоритм фактически в лоб, просто перебор
* всех элементов, мозги и так плавятся =))))
*
* Пример:
* console.log(theMadness([1, 4, 6, 98, 3, 2, 7, 8, 90, 12, 8]));
* Возвращает массив комбинаций элементов, где каждый элемент бредставлен объектом
@SerafimArts
SerafimArts / gist:ad0b651cc23297db11fe
Created December 20, 2013 13:54
Yandex Disk WebDav
<?php
/**
* Зависимости:
* - Sabre: https://github.com/fruux/sabre-dav
* - Carbon: https://github.com/briannesbitt/Carbon
*
* Использование:
* $ya = new \Ya\Disk(base64_encode(LOGIN . ':' . PASSWORD));
* $wdc = $ya->getDisk();
* print_r($wdc->getDirectory('/'));
@SerafimArts
SerafimArts / tips.md
Last active October 22, 2021 21:43
Tips And Tricks: PhoneGap + Mobile Development (~2015 year)
  • На iOS устройствах числовые значения подчёркиваются синим. Эта проблема возникает из-за того, что iOS устройства по умолчанию считают все числа похожие на телефонные номера - телефонными номерами. Решается добавлением <meta name="format-detection" content="telephone=no" /> Тоже самое касается адреса: <meta name="format-detection" content="address=no" />

  • Пользователь может уменьшать и увеличивать приложение. Решается добавляением тега <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />

  • Ссылки нажимаются с задержкой (примерно 300ms). Решается подпиской на событие touchstart и принудительной инициализацией события click после него. Если проблема всё равно возникает - ничего не поделать, надо облегчать dom. Как вариант - можно использовать библиотеку, посоветанную @adubovsky ниже в комментариях: https://gist.github.com/SerafimArts/de9900f99

@SerafimArts
SerafimArts / Ai.php
Last active March 26, 2023 05:58
AI (Adobe Illustrator) Reader
<?php
namespace app\support\lib;
class Rect
{
protected $left;
protected $top;
protected $width;
protected $height;
// by Erik Wrenholt
import java.util.*;
class Mandelbrot
{
static int BAILOUT = 16;
static int MAX_ITERATIONS = 1000;
private static int iterate(float x, float y)
{
@SerafimArts
SerafimArts / grid-system.scss
Last active October 10, 2017 03:24
Simple SASS grid system
/**
* Grid System Core
* Licensed under GPL and MIT.
*
* @version 1.0
* @author Nesmeyanov Kirill aka Serafim
*/
/**
{
"dependencies": {
// Babel (ES6, ES7, Flow, etc...)
"babel-core": "5.8.*",
"gulp-babel": "5.2.*",
// CoffeeScript
"gulp-coffee": "^2.3.1",
// Sass and Scss
@SerafimArts
SerafimArts / Observable.js
Created September 29, 2015 12:45
ES Example (ES6 Symbol + ES7 Decorators + ES7 Object properties)
/**
* ObservablePrimitive instance
*/
class ObservablePrimitive {
/**
* @constructor
* @param value
*/
constructor(value = null) {
this.events = {
import Vector2 from "/Core/Math/Vector2";
import Rotation from "/Core/Math/Rotation";
import {AClass, AProperty} from "/Core/Annotations/Meta";
@AClass('Basic Actor')
export default class Actor {
/**
* @type {boolean}
*/