Skip to content

Instantly share code, notes, and snippets.

View marcuzy's full-sized avatar
:octocat:

Oleg Krasavin marcuzy

:octocat:
View GitHub Profile
@marcuzy
marcuzy / hell.ts
Created August 18, 2023 10:35
TS Hell
interface Event<P> {
type: string;
payload: P;
}
type UserCreatedEvent = Event<{
id: string;
fullName: string;
email: string;
role: string;
@marcuzy
marcuzy / user-created.v1.json
Created August 16, 2023 08:30
JSON Schema Example
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"definitions": {
"payload": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The unique identifier for a user."
node app.js videourl audiourl
Exmaple:
node app.js https://kinescopecdn.net/192306f6-275d-4aa7-885e-d9cf8b0f72f5/videos/30764e9a-b6ea-48a5-82e6-113dda5e4bf1/assets/5a90932b-d2b6-4529-a713-c39c2238838b/1080p.mp4\?expires\=1640597177\&sign\=79391590fe0523a56bb042ef33c6fc9d https://kinescopecdn.net/192306f6-275d-4aa7-885e-d9cf8b0f72f5/videos/30764e9a-b6ea-48a5-82e6-113dda5e4bf1/assets/5c79ef12-c76d-4077-a82e-085f2a31130a/audio_0.mp4\?expires\=1640597177\&sign\=5ed29fc7d33f5c53aa8fc033c818fa74
@marcuzy
marcuzy / hanging.ts
Created January 22, 2018 06:24
IDE freezes when some typescipt files are opened
const validators = new class {
foo(): this {
return this;
}
bar(): this {
return this;
}
hello(): this {
@marcuzy
marcuzy / bug-example.js
Created January 12, 2018 09:05
The example to reproduce a bug which related to not showing the username and icon_url
const { WebClient } = require('@slack/client');
const client = new WebClient('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
client.chat.postMessage('#general', 'Text 1', {
username: 'Test 1',
icon_url: 'https://slack-files2.s3-us-west-2.amazonaws.com/avatars/2017-07-31/219779967281_6024f981fe6f5a28b840_36.png'
});
client.chat.postMessage('#general', 'Text 2', {
@marcuzy
marcuzy / youtube-captions-to-middle.js
Created June 26, 2017 10:28
Move Youtube Captions to middle of screen via tampermonkey
// ==UserScript==
// @name YoutubeCaptionsToMiddle
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Move Youtube Captions to middle of screen
// @author marcuzy
// @match *.youtube.com/watch*
// @grant none
// ==/UserScript==
@marcuzy
marcuzy / scrollPageToVanilla.js
Created September 14, 2016 09:22
Scroll Page To in Vanilla JS
function scrollPageTo(position, delta) {
delta *= Math.sign(position - document.body.scrollTop);
window.requestAnimationFrame(function animation() {
document.body.scrollTop += delta;
if (delta < 0 && position >= +document.body.scrollTop) {
return;
}
@marcuzy
marcuzy / ng2-modal.js
Created September 9, 2016 05:49
Fix body class for ng2-modal 0.0.13 (https://github.com/pleerock/ng2-modal)
import { MODAL_DIRECTIVES } from "ng2-modal";
const Modal = MODAL_DIRECTIVES[0];
Modal.prototype.close = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
if (!this.isOpened)
@marcuzy
marcuzy / FileHelper.php
Last active June 24, 2016 09:18
Удалить файла или папку по конце работы скрипта
<?php
class FileHelper extends \yii\helpers\FileHelper
{
public static function removeInTheEnd($filename)
{
register_shutdown_function(function() use ($filename) {
if (file_exists($filename)) {
if (is_dir($filename)) {
static::removeDirectory($filename);
@marcuzy
marcuzy / min_viber.sh
Created May 19, 2016 03:37
Minimize Viber in Linux (use for startup app)
#!/usr/bin/env bash
wmctrl -c "Viber "