Skip to content

Instantly share code, notes, and snippets.

View andrey-skl's full-sized avatar

Andrey Skladchikov andrey-skl

View GitHub Profile
@andrey-skl
andrey-skl / setWaitingInterval.ts
Created August 7, 2025 13:48
setWaitingInterval.ts
const map = new Map<number, number>();
let waitingIntervalId = 0;
function getLastUntilOneLeft(arr: number[]): number {
if (arr.length > 1) {
const item = arr.pop();
if(typeof item !== 'number'){
throw new Error('Invalid item type');
@andrey-skl
andrey-skl / overrides.json
Created October 5, 2018 10:48
Ring UI Darkula CSS values
{
"--ring-line-color": "#3e4d59",
"--ring-borders-color": "#7a8b99",
"--ring-pale-control-color": "var(--ring-borders-color)",
"--ring-popup-border-components": "150, 150, 150",
"--ring-link-color": "#70b1e6",
"--ring-error-color": "#db5860",
"--ring-text-color": "#ddd",
"--ring-heading-color": "#ddd",
"--ring-secondary-color": "#aaa",
(function setTheme() {
let properties = {
'--ring-line-color': '#263b4c',
'--ring-dark-line-color': '#263b4c',
'--ring-borders-color': '#b8d1e5',
'--ring-icon-color': 'var(--ring-borders-color)',
'--ring-border-disabled-color': '#dbdbdb',
'--ring-icon-disabled-color': 'var(--ring-border-disabled-color)',
'--ring-border-hover-color': '#80c6ff',
'--ring-icon-hover-color': 'var(--ring-border-hover-color)',
@andrey-skl
andrey-skl / request.kt
Created June 21, 2018 21:45
KotlinJS Fetch with coroutines
package app
import kotlinx.coroutines.experimental.await
import org.w3c.fetch.*
import kotlin.browser.window
import kotlin.js.json
class FetchError(message: String, status: Number, response: dynamic) : Error(message)
suspend fun makeError(res: Response): FetchError {
@andrey-skl
andrey-skl / README.md
Last active September 14, 2017 08:55
GitHub User Widget for JetBrains Hub

This example uses ECMAScript 2016 features, so it will work in modern browsers only

Developing

  1. NodeJS and NPM are required
  2. Install http-server npm i http-server -g
  3. Run it in example folder http-server . --cors -c-1 -p 9033
  4. If you have Hub running over HTTPS, you need to host your widget over HTTPS as well. https://ngrok.com should help.
  5. Open widgets playground (/dashboard/widgets-playground) and enter your devserver address.
@andrey-skl
andrey-skl / clean-dashboards.js
Created March 20, 2017 09:17
JetBrains Hub dashboards cleaning snippet
/*
Run this script in Chrome > 50. See guide here https://developers.google.com/web/tools/chrome-devtools/snippets
Backup your dashboards before running it.
Script provided "as is", there is no warranty that it won't remove wrong dashboard.
*/
(function() {
/*
Leave empty if Hub is hosted on the same URL and does not have context. (e.q. standalone Hub)
Fill with '/hub/' if running on youtrack cloud instance.
*/
@andrey-skl
andrey-skl / angular-arrows-to-fns.js
Last active December 14, 2016 18:30
Converts arrow functions, mistakely used for controllers, factories and services, to normal function expressions. Example usage http://astexplorer.net/#/4JAWwc4Jmf/1
//Usage: jscodeshift -t angular-arrows-to-fns.js <pathes to files>
var THING_TO_REPLACE = 'controller';
module.exports = (file, api, options) => {
const j = api.jscodeshift;
const root = j(file.source);
return root
@andrey-skl
andrey-skl / Functional.js
Last active December 2, 2016 13:30
Alerts example
import Alert from 'alert';
<Alerts>
{myStore.alerts.map(alert => {
<Alert key={alert.key} onClose={() => ...remove alert from store}>{alert}</Alert>
})}
</Alerts>
@andrey-skl
andrey-skl / AppDelegate.m
Created November 16, 2016 14:36
How to enable logging in production build of React Native app
...
#import "RCTLog.h"
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
RCTSetLogThreshold(RCTLogLevelInfo);
...
@andrey-skl
andrey-skl / init.coffee
Last active May 19, 2016 17:51
Setting of my atom editor
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
#
# path = require 'path'
#