Skip to content

Instantly share code, notes, and snippets.

View DenisDov's full-sized 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,
};
@DenisDov
DenisDov / paste.js
Last active October 22, 2020 15:08
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 August 7, 2020 09:04
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 January 15, 2020 06:45 — 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

@DenisDov
DenisDov / SQL.md
Last active November 2, 2020 12:37
View SQL.md

Create table

CREATE TABLE Users (
	id MEDIUMINT AUTO_INCREMENT,
  email VARCHAR(50),
  password VARCHAR(50),
  PRIMARY KEY(id)
)
@DenisDov
DenisDov / mysql_cheat_sheet.md
Created December 11, 2019 09:07 — forked from bradtraversy/mysql_cheat_sheet.md
MySQL Cheat Sheet
View mysql_cheat_sheet.md

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH