Skip to content

Instantly share code, notes, and snippets.

View alexohotnikov's full-sized avatar
🏠
Remote worker.

Aleksander Ohotnikov alexohotnikov

🏠
Remote worker.
View GitHub Profile
@alexohotnikov
alexohotnikov / code.txt
Created March 16, 2020 07:20
macOS premission
Correct. /usr/local can no longer be chown'd in High Sierra. Instead use
`sudo chown -R $(whoami) $(brew --prefix)/*`
@alexohotnikov
alexohotnikov / index.js
Created June 16, 2019 17:33
quick sort :: js
const quicksort = array => {
if (array.length === 0) return [];
let [x, ...xs] = array;
return [
...quicksort(xs.filter(y => y < x)),
x,
...quicksort(xs.filter(y => y >= x))
];
};
@alexohotnikov
alexohotnikov / index.js
Last active June 16, 2019 16:13
Search Index of element through Array :: Binary with recursive
function binarSearch(arr, key) {
let
startIndex = 0,
endIndex = arr.length,
count = 0;
function itter(start, left) {
count += 1;
let middle = (start + left) >> 1
@alexohotnikov
alexohotnikov / quillHelpers.coffee
Created October 30, 2018 10:21
Упрощалка для QuillInputa
$$.mayBeCool = (quill) ->
ltx = quill.result.latex
allDigit = ltx.match(/\{(\d*)/ig)
# преобразует 0 -- если нужно
__nullMake = (latex) ->
resultQuill = $$.QuillInput.calculate_latex latex
_fnLatx = latex
if resultQuill is 0
_fnLatx = "0"
quill.set _fnLatx
@alexohotnikov
alexohotnikov / hint_content.coffee
Created August 24, 2018 12:35
animateChange hint content
$$.helpers.changeHintContent = (hint, text) ->
hint.hide ->
hint.changeContent text
content = hint.view.find('.hint_content')
content.css({ left: 512 - content.outerWidth()/2})
hint.view.css({ left: 0 })
hint.show()
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
// == Enforcing Options ===============================================
//
// These options tell JSHint to be more strict towards your code. Use
// them if you want to allow only a safe subset of JavaScript, very
@alexohotnikov
alexohotnikov / main.js.coffee
Last active July 14, 2018 13:16
[#InputBlock #Digits #Animate] #animate
# inputView - DOM Node of element
$$.func.inputBlockPerfectDigit = (inputView) =>
inputView.addClass('squeeze')
inputView.find('.input-body__digit:empty').toArray().forEach((value) =>
$(value).remove()
)
@alexohotnikov
alexohotnikov / README.md
Last active July 11, 2018 10:50
[ #Input ] #ReadCustom

Read Input Custom

Кастомная штучка для прослушки инпутов, в данном примере мы прослушываем инпут и меняем текст в зависимости от введенного значения

Вид в файле конфигурации

 %1{пример}{примера}{примеров}
@alexohotnikov
alexohotnikov / main.coffee
Last active July 10, 2018 17:28
[#RadioButtons] #select-conrol
config =
className: 'radio-button-block'
content: 'radio'
parent: @dom.radioCont
radioButtons = [
this.tutor.t('variant_1'),
this.tutor.t('variant_2'),
this.tutor.t('variant_3'),
].map (value) =>
@alexohotnikov
alexohotnikov / func.js
Last active July 10, 2018 08:45
[#CoordSystem & points end & start] Границы точки на графике
/// в основном коде
const pointGraph =
$$.func.getGraphsPoint(this.system.getGraphs()[0].o.functions[0].memo)
/// лучше отдельно ::
$$.func = $$.func || {}