Skip to content

Instantly share code, notes, and snippets.

View frontbastard's full-sized avatar
🇺🇦
Focusing

Pavlo Sokolov frontbastard

🇺🇦
Focusing
View GitHub Profile
#!/bin/sh
#https://github.com/PythonicNinja/jetbrains-reset-trial-mac-osx/blob/master/runme.sh
for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine Rider; do
echo "Closing $product"
ps aux | grep -i MacOs/$product | cut -d " " -f 5 | xargs kill -9
echo "Resetting trial period for $product"
@frontbastard
frontbastard / reset.sh
Created January 23, 2024 21:43
[reset jetbrains application trial] reset jetbrains ide evals v1.0.4 #others
#!/bin/bash
# reset jetbrains ide evals v1.0.4
OS_NAME=$(uname -s)
JB_PRODUCTS="IntelliJIdea CLion PhpStorm GoLand PyCharm WebStorm Rider DataGrip RubyMine AppCode"
if [ "$OS_NAME" == "Darwin" ]; then
echo 'macOS:'
for PRD in $JB_PRODUCTS; do
import React, { useState } from "react";
import "./styles.css";
export default function App() {
const [counter, setCounter] = useState(0);
const [step, setStep] = useState(1);
const date = new Date();
date.setDate(date.getDate() + counter);
@frontbastard
frontbastard / index.ts
Created September 23, 2022 15:09
RxJS draw canvas square
import { fromEvent } from "rxjs";
import { map, pairwise, switchMap, takeUntil } from "rxjs/operators";
const canvas = document.querySelector("#canvas") as HTMLCanvasElement;
const context = canvas.getContext("2d");
context.lineWidth = 4;
interface Position {
@frontbastard
frontbastard / index.js
Last active September 23, 2022 17:14
RxJS debounced search
const { fromEvent } = require("rxjs");
const { debounceTime, map, takeUntil } = require("rxjs/operators");
const search = document.querySelector("#search");
const stop = document.querySelector("#stop");
const search$ = fromEvent(search, "input");
const stop$ = fromEvent(stop, "click");
search$
@frontbastard
frontbastard / package-lock-conflicts.md
Created August 2, 2022 21:38 — forked from szemate/package-lock-conflicts.md
How to resolve package-lock.json conflicts

How to resolve package-lock.json conflicts

It is not possible to resolve conflicts of package-lock.json in GitHub's merge tool and you need to do a manual merge.

  1. Update the master branch with the latest changes:
    git checkout master
    git pull
    
  2. Merge your feature branch into master:
@frontbastard
frontbastard / getdates.js
Created January 27, 2021 21:45 — forked from miguelmota/getDates.js
Get dates in between two dates with JavaScript.
// Returns an array of dates between the two dates
var getDates = function(startDate, endDate) {
var dates = [],
currentDate = startDate,
addDays = function(days) {
var date = new Date(this.valueOf());
date.setDate(date.getDate() + days);
return date;
};
while (currentDate <= endDate) {
@frontbastard
frontbastard / animateElementsOnScroll.js
Last active July 14, 2020 19:00
Animate elements on scroll, for example parallax images
let imagesSlow = el.querySelectorAll('.banner-parallax-slow');
let imagesFast = el.querySelectorAll('.banner-parallax-fast');
function animateElement(image, val) {
let offset = image.offsetTop;
let positionToWindow = offset - window.pageYOffset;
image.style.transform = 'translateY(' + positionToWindow / val + 'px)';
}
imagesSlow.forEach(el => {
@frontbastard
frontbastard / index.js
Created September 20, 2019 11:10
Scroll direction detector
function setScrollDirection() {
let scrollPos = 0;
$(window).on('scroll resize', function () {
if (document.body.getBoundingClientRect().top === 0) {
$('body').removeAttr('data-scroll-direction');
return false;
}
if ((document.body.getBoundingClientRect()).top > scrollPos)
@frontbastard
frontbastard / script.js
Created July 25, 2019 13:56
Get scrollbar width
function getScrollbarWidth() {
return window.innerWidth - document.documentElement.clientWidth;
}