Skip to content

Instantly share code, notes, and snippets.

@RB-Lab
RB-Lab / background_runner.py
Created December 1, 2022 15:40
Python snipets
import asyncio
import subprocess
import threading
import time
class BackgroundRunner:
def __init__(self):
self.proc = None
self.is_running = False
self.count = 0
@RB-Lab
RB-Lab / 0-linux-hacks.md
Last active December 10, 2021 19:14
My Tweaks and Hacks for Linux

Install & configure OhMyZSH & vim

See here

Make Gnome Terminal open new tab in the same directory

Go to PreferencesProfile [default profile]Command

  1. Check "Run command as a login shell"
  2. Select "Preserve working directory: always"

Hide Dock

See this my answer on Ask Ubuntu. Ans also you need to set to false "Extend height" to minimize Dock when "Activities" activated

@RB-Lab
RB-Lab / test-task.md
Last active August 5, 2020 15:04
Enapter junior frontend test task

Enapter junior frontend test task

Create a registration form with the following fields:

  • User name (must be longer than 3 characters, only latin letters allowed, starts with capital letter)
  • Email (must be a valid email)
  • Phone number (must be a valid phone number; hyphens and parentheses for city code allowed)
  • Password (must be longer than 6 characters, must include digits, upper and lower case letters, may include special characters (!@#$%^&*()}{><>}) but must not include spaces or non-latin unicode characters)
  • Password repeat (must be the same as Password)
@RB-Lab
RB-Lab / ts-utils.ts
Created July 17, 2020 16:45
usefull small utils for TS
export function notEmpty<TValue>(
value: TValue | null | undefined
): value is TValue {
return value !== null && value !== undefined;
}
export type Maybe<T> = null | undefined | T;
export function filterMaybeArrayMaybe<T>(array: Maybe<Maybe<T>[]>) {
@RB-Lab
RB-Lab / VSCode Settings
Last active December 4, 2018 04:31
Settings for VSCode
Settings for VSCode
@RB-Lab
RB-Lab / boxes.css
Last active September 13, 2018 14:52
Space craft shop demo: You can copy-paste js to you chrome console → sources → snipets, hit cmd+enter and play around!
.box {
margin: 10px;
height: 50px;
width: 50px;
display: inline-block;
}
.rocket {
background: url(http://www.rockybytes.com/i/924/mp3-rocket.jpg);
}
@RB-Lab
RB-Lab / aliases.sh
Created January 17, 2017 11:24
Useful aliases for .zshrc/.bashrc
alias untgz="tar -xvzf"
alias hg="history | grep "
alias git-clear="git branch -d $(git branch --merged)"
alias lsl="ls -l"
@RB-Lab
RB-Lab / karma.conf.js
Created November 30, 2015 10:39
Minimal Karma config for use with React & Babel & Browserify
// you need to $ npm i -D babel-preset-es2015 babel-preset-react babel-preset-stage-0 babelify karma karma-browserify karma-chai karma-mocha karma-mocha-reporter karma-phantomjs-launcher phantomjs-polyfill array.from
module.exports = function conf(config) {
config.set({
frameworks: ['browserify', 'mocha', 'chai'],
plugins: [
'karma-browserify',
'karma-mocha',
'karma-chai',
'karma-phantomjs-launcher',
@RB-Lab
RB-Lab / live-templates.md
Last active April 18, 2017 16:45
Live templates for InteliJ Idea JavaScript files (you can copy them and paste into according templates "folder")

unit-tests

<template name="dsc" value="describe('$text$', () =&gt; {&#10;    $end$&#10;});" description="describe for tests suites" toReformat="false" toShortenFQNames="true">
  <variable name="text" expression="" defaultValue="" alwaysStopAt="true" />
  <variable name="end" expression="" defaultValue="" alwaysStopAt="true" />
  <context>
    <option name="JS_STATEMENT" value="true" />
  </context>
</template>
function encodeAsUrl_(params){
return Object.keys(params).map(key => key + '=' + params[key]).join('&')
}
function handleResponce_(xhr, cb, errcb){
return function () {
if (4 === xhr.readyState) {
if(xhr.status >= 200 && xhr.status < 400){
cb(xhr);