Skip to content

Instantly share code, notes, and snippets.

View DenisDov's full-sized avatar
🏠
Working from home

Denys Dovzhenko DenisDov

🏠
Working from home
View GitHub Profile
@DenisDov
DenisDov / .tsx
Created January 15, 2024 17:26
React Native Skia windmill
const { width } = useWindowDimensions();
const RADIUS = width / 2;
const NUM_SLICES = 8;
const renderPath = () => {
const sliceAngle = (2 * Math.PI) / NUM_SLICES;
const paths = [];
const colors = [
"#FF5733",
"#FFC300",
@DenisDov
DenisDov / .tsx
Last active January 15, 2024 16:41
React Native Skia umbrella
const RADIUS = 100;
const NUM_SLICES = 8;
const renderPath = () => {
const sliceAngle = (2 * Math.PI) / NUM_SLICES;
const paths = [];
const colors = [
"#FF5733",
"#FFC300",
"#36A2EB",
// Expo SDK41
// expo-blur: ~9.0.3
import React, { useRef } from 'react';
import {
Animated,
Image,
ImageBackground,
ScrollView,
StatusBar,
const providerConfig = {
domain: config.domain,
clientId: config.clientId,
...(config.audience ? { audience: config.audience } : null),
redirectUri: window.location.origin,
onRedirectCallback,
};
@DenisDov
DenisDov / SQL.md
Last active November 2, 2020 12:37

Create table

CREATE TABLE Users (
	id MEDIUMINT AUTO_INCREMENT,
  email VARCHAR(50),
  password VARCHAR(50),
  PRIMARY KEY(id)
)
@DenisDov
DenisDov / paste.js
Last active October 22, 2020 15:08
Insert commas between numbers after paste into input
function dividePastedValuesByCommas(e) {
/* bind on paste event */
e.preventDefault();
const target = e.target,
val = target.value,
start = target.selectionStart,
arr = e.originalEvent.clipboardData
.getData('text')
.replace(/\r\n\t|\n|\r\t|\s|,|;/gm, ' ')
lsof -ti:5901 | xargs kill -9
@DenisDov
DenisDov / toggleClass.js
Last active August 7, 2020 09:04
Vanilla js implementation jquery $(this).addClass('is-selected').siblings().removeClass('is-selected');
const toggleElements = document.querySelectorAll("#table tr");
toggleElements.forEach(el => {
el.addEventListener("click", function () {
this.classList.toggle("is-selected");
// siblings
Array.prototype.filter.call(el.parentNode.children, function (child) {
return child !== el && child.classList.remove("is-selected");
});

Revert a Git repository to a previous commit

git reset --hard [previous Commit SHA id here]
git push origin [branch Name] -f

It will remove your previous Git commit. If you want to keep your changes, you can also use:

git reset --soft [previous Commit SHA id here]
async function addImageToDOM() {
const imageDiv = document.createElement('div');
imageDiv.className = 'one-fourth';
const imgElement = document.createElement('img');
imgElement.src = generateImageLinks();
imageDiv.append(imgElement);
document.querySelector('.container').append(imageDiv);
}