Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
...

Denis DenisDov

:octocat:
...
View GitHub Profile
View react-native-animated_twitter-profile.jsx
// Expo SDK41
// expo-blur: ~9.0.3
import React, { useRef } from 'react';
import {
Animated,
Image,
ImageBackground,
ScrollView,
StatusBar,
View Condition add prop to object
const providerConfig = {
domain: config.domain,
clientId: config.clientId,
...(config.audience ? { audience: config.audience } : null),
redirectUri: window.location.origin,
onRedirectCallback,
};
View VSCODE SIMPLE SETTINGS
{
"tabnine.experimentalAutoImports": true,
"editor.fontLigatures": true,
"editor.fontFamily": "Fira Code, Menlo, Monaco, 'Courier New', monospace",
"workbench.iconTheme": "vscode-great-icons",
"workbench.colorTheme": "Atom One Dark",
"emmet.triggerExpansionOnTab": true,
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "modifications",
"editor.defaultFormatter": "esbenp.prettier-vscode",
@DenisDov
DenisDov / paste.js
Last active Oct 22, 2020
Insert commas between numbers after paste into input
View paste.js
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, ' ')
@DenisDov
DenisDov / toggleClass.js
Last active Aug 7, 2020
Vanilla js implementation jquery $(this).addClass('is-selected').siblings().removeClass('is-selected');
View toggleClass.js
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");
});
View gist:e9706792b9d5e12e01b8c6d9e4d7158d

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]
View infinite scroll
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);
}
@DenisDov
DenisDov / vscode_shortcuts.md
Created Jan 15, 2020 — forked from bradtraversy/vscode_shortcuts.md
Helpful shortcuts for VSCode
View vscode_shortcuts.md

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

View SQL.md

Create table

CREATE TABLE Users (
	id MEDIUMINT AUTO_INCREMENT,
  email VARCHAR(50),
  password VARCHAR(50),
  PRIMARY KEY(id)
)