Skip to content

Instantly share code, notes, and snippets.

Avatar

Nikita Butenko nkbt

View GitHub Profile
@nkbt
nkbt / loader.js
Last active Nov 19, 2019
Old fashioned loader
View loader.js
var loading = "\\|/—",
tick = 0,
loadingElement = document.createElement('div');
loadingElement.id = 'loading';
loadingElement.style.fontFamily = 'Consolas, "Liberation Mono", Courier, monospace';
document.body.innerHTML = '';
document.body.appendChild(loadingElement);
(function animate() {
tick = (tick + 1) % loading.length;
@nkbt
nkbt / .jshintrc
Last active Dec 17, 2016
.jshintrc - NodeJS
View .jshintrc
{
// -----------------
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
@nkbt
nkbt / .jshintrc
Last active Apr 8, 2018
.jshintrc - Browser
View .jshintrc
{
// -----------------
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
View domain.js
'use strict';
/**
* @typedef {Entity} DomainEntity
*
* @property {function(): String} getId
* @property {function(): String} getName
* @property {function(): Number} getPrice
* @property {function(): Number} getQuantity
*
@nkbt
nkbt / PeopleBrowsr.xml
Created Dec 17, 2013
PeopleBrowsr PHP/Webstorm auto-formatter config put to: <user>/.WebIde70/config/codestyles/PeopleBrowsr.xml
View PeopleBrowsr.xml
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="PeopleBrowsr">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
@nkbt
nkbt / Quall Dracula.icls
Created Dec 17, 2013
Less aggressive Dracula color theme for PHP/Webstorm
View Quall Dracula.icls
<?xml version="1.0" encoding="UTF-8"?>
<scheme name="Quall Dracula" version="124" parent_scheme="Default">
<option name="LINE_SPACING" value="1.1" />
<option name="EDITOR_FONT_SIZE" value="14" />
<option name="CONSOLE_FONT_NAME" value="Consolas" />
<option name="CONSOLE_FONT_SIZE" value="16" />
<option name="CONSOLE_LINE_SPACING" value="0.9" />
<option name="EDITOR_FONT_NAME" value="Consolas" />
<colors>
<option name="ADDED_LINES_COLOR" value="d6822" />
View app.js
require.config({
urlArgs: window.noCacheSuffix,
baseUrl: 'js',
paths: {
underscore: 'vendor/underscore',
dom: 'vendor/jquery',
bootstrap: '../lib/bootstrap/js/bootstrap',
Firebase: 'https://cdn.firebase.com/v0/firebase',
FirebaseSimpleLogin: 'https://cdn.firebase.com/v0/firebase-simple-login'
},
View chat.js
define('app/chat', [
'dom', 'underscore', 'lib/app'
], function ($, _, app) {
"use strict";
function init() {
var $element = $('.jsAppChat').html(app.template('template/app/chat'));
$element.find('.jsAppChat-formContainer')
.html(app.template('template/app/chat/form'));
}
View app.lib.payment.js
it('should return error if at least one domain is unavailable', function (done) {
nock(test.mock.user)
.intercept('/info', 'SEARCH', {"count": 100, "query": "data.name:\"test.test\" AND type:\"domain\" AND name:\"reseller.pb\""})
.replyWithFile(200, __dirname + '/fixtures/info/found.json');
nock(test.mock.admin)
.get('/user/aaaa11112222333344445555', {})
.replyWithFile(200, __dirname + '/fixtures/user/_nkbt.json');
View async-auto.js
var _ = require('underscore');
var async = require('async');
async.auto({
first: function(next) {
setTimeout(next, 500);
},
second: function(next) {
setTimeout(next, 700);
},