This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
What's better way to find a class match – `classes.indexOf(className)` or `for loop + return`? | |
*/ | |
function hasClass(el, className) { | |
var classes = el.className.split(' '); | |
for (var i = 0; i < classes.length; i++) { | |
if (classes[i] === className) { | |
return true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
property bool collecting: false | |
property var bbbbb: { | |
if (!collecting) { | |
collecting = true; | |
collect(branchCardBody) | |
} | |
} | |
function newEvent(item, eventName) { | |
var globalCoord = item.mapToItem(null, 0, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alert(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
@param {Object} node | |
@param {Number} spacing | |
*/ | |
function traverse(node, spacing) { | |
console.info('NODE ::', _spacing(spacing), node) | |
var children = node.data; | |
if (!children) return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import QtQuick 2.3 | |
// @TODO (salnikov): добавить минимальные отступы клеткам | |
Rectangle { | |
width: 200 | |
height: 600 | |
property real maxWidth: 200 | |
property real maxWidthHalf: maxWidth / 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
Бинарный поиск ближайшего значения. Если значение за пределами списка, возвращает индекс крайнего элемента. | |
Возвращает индекс найденного элемента. | |
x >> 1 === Math.floor(x / 2) | |
\param type:array list | |
\param type:number value | |
\param type:function getVal функция, которая достает нужное значение из элемента списка list | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# exclude ".qml.*" because QtCreator on change 'Transport.qml' creates additional file like 'Transport.qml.R12384' | |
cd src/v4qml | |
inotifywait -mre close_write --exclude '\.qml\.' --format "%w %f" . | while read dir file; do | |
# cut './' from the path './RegionUI/...' → 'RegionUI/...' | |
f="${dir:2}$file" | |
echo "Changed: $f" | |
# @TODO change 'drz' to $1 | |
adb push "$f" "/sdcard/drz/$f" | |
adb shell am force-stop ru.dublgis.dgismobile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
\brief Если `flag` праведный, то выполнить `callback`, иначе подписаться на событие `sig` | |
Варианты реализации `flag`: | |
1. передать имя свойства (+ в любой момент времени можно проверить актуальность флага) | |
2. передать функтор (+ в любой момент времени можно проверить актуальность флага) | |
3. передать значение свойства (- узнать значение флага можно только в текущий момент времени) | |
Здесь используется последний, где `flag` — это буль | |
\param type:bool flag | |
\param type:Signal sig | |
\param type:function callback |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var willHide = false; | |
var msgBox = document.createElement('div'); | |
msgBox.style.position = 'fixed'; | |
msgBox.style.top = '10px'; | |
msgBox.style.right = '10px'; | |
msgBox.style.display = 'none'; | |
document.body.appendChild(msgBox); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* <a href='http://api.yandex.ru/dictionary/'>Реализовано с помощью сервиса «API «Яндекс.Словарь»</a> | |
*/ | |
(function() { | |
const YANDEX_DICTIONARY_KEY = 'dict.1.1.20150130T172350Z.0895b15babe24c90.431f35fa9af476be1b6d14d80f3809ab693a5970'; | |
const DICTIONARY_URL = `https://dictionary.yandex.net/api/v1/dicservice.json/lookup?key=${YANDEX_DICTIONARY_KEY}&lang=en-ru` | |
function translate(word) { | |
fetch(`${DICTIONARY_URL}&text=${word}`) | |
.then(res => res.json()) |