Skip to content

Instantly share code, notes, and snippets.

View shov's full-sized avatar
🐊
^^

Alexander Shevchenko shov

🐊
^^
View GitHub Profile
@shov
shov / coulours.js
Created January 18, 2023 12:36
Colour and css in chrome console
// Author: https://stackoverflow.com/users/211676/bartburkhardt
// Src: https://stackoverflow.com/questions/7505623/colors-in-javascript-console
var css = "text-shadow: -1px -1px hsl(0,100%,50%), 1px 1px hsl(5.4, 100%, 50%), 3px 2px hsl(10.8, 100%, 50%), 5px 3px hsl(16.2, 100%, 50%), 7px 4px hsl(21.6, 100%, 50%), 9px 5px hsl(27, 100%, 50%), 11px 6px hsl(32.4, 100%, 50%), 13px 7px hsl(37.8, 100%, 50%), 14px 8px hsl(43.2, 100%, 50%), 16px 9px hsl(48.6, 100%, 50%), 18px 10px hsl(54, 100%, 50%), 20px 11px hsl(59.4, 100%, 50%), 22px 12px hsl(64.8, 100%, 50%), 23px 13px hsl(70.2, 100%, 50%), 25px 14px hsl(75.6, 100%, 50%), 27px 15px hsl(81, 100%, 50%), 28px 16px hsl(86.4, 100%, 50%), 30px 17px hsl(91.8, 100%, 50%), 32px 18px hsl(97.2, 100%, 50%), 33px 19px hsl(102.6, 100%, 50%), 35px 20px hsl(108, 100%, 50%), 36px 21px hsl(113.4, 100%, 50%), 38px 22px hsl(118.8, 100%, 50%), 39px 23px hsl(124.2, 100%, 50%), 41px 24px hsl(129.6, 100%, 50%), 42px 25px hsl(135, 100%, 50%), 43px 26px hsl(140.4, 100%, 50%), 45px 27px hsl
@shov
shov / TS_cases.ts
Created November 16, 2022 14:11
TS snake case to camel case
// Original author is ford04 (https://stackoverflow.com/users/5669456/ford04)
// Original answer on stack overflow (https://stackoverflow.com/questions/60269936/typescript-convert-generic-object-from-snake-to-camel-case)
type SnakeToCamelCase<S extends string> =
S extends `${infer T}_${infer U}` ?
`${T}${Capitalize<SnakeToCamelCase<U>>}` :
S
type CamelToSnakeCase<S extends string> =
S extends `${infer T}${infer U}` ?
`${T extends Capitalize<T> ? "_" : ""}${Lowercase<T>}${CamelToSnakeCase<U>}` :
@shov
shov / waves.html
Created June 4, 2022 20:37
draw waves on html canavs 2d context
<html>
<head></head>
<body>
<canvas id="myCanvas" width="1000" height="1000"/>
<script>
var c = document.getElementById("myCanvas");
@shov
shov / default.conf
Created March 18, 2020 08:41
Nginx to Nodejs proxy with SSL
server {
listen 80;
server_name example.com;
# Redirect all traffic to SSL
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
@shov
shov / reborn_brew.sh
Created April 1, 2019 12:16
Reborn brew packages after migration
#!/bin/bash
brew list -1 > brew.txt \ # list out all installed packages
&& brew list -1 | xargs brew rm --force \ # remove all installed packages
&& brew install $(cat brew.txt | tr '\n' ' ') \ # install all previously installed packages
&& rm brew.txt
@shov
shov / autoload.php
Last active February 13, 2019 06:28 — forked from holisticnetworking/autoload.php
Autoloading for both WordPress classes and PSR-4
<?php
/**
* Autoload PSR-4 and Wordpress compatible named classes,
* Require it in very begin of your functions.php or plugin
*
* @author Alexandr Shevchenko <ls.shov@gmail.com>
* @author Thomas J Belknap <tbelknap@holisticnetworking.net>
*/
namespace App; //Change it
/** @var string : autoload root $rootDir */
@shov
shov / links.txt
Created January 22, 2019 12:57
XDebug on laradock
@shov
shov / gitroutine.md
Last active November 6, 2018 09:54
git routine

New empty repository started on github

  1. Go github, create new repo
  2. Copy ssh/https link
  3. Go to your project folder 4.git clone <paste link here> and all project will be downloaded to new folder with same name as project is
  4. Or you can set name of this folder git clone <paste link here> newfolder

New repository from existing project

@shov
shov / git_log.sh
Created October 11, 2018 09:25
Beautiffied git log
git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
@shov
shov / Dockerfile
Created May 21, 2018 14:46
Docker file for PHP 7.2 fpm with mcrypt support
FROM php:7.2-fpm
# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# make sure apt is up to date
RUN apt-get update --fix-missing
RUN apt-get install -y curl
RUN apt-get install -y build-essential libssl-dev zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev