Skip to content

Instantly share code, notes, and snippets.

View GeorgianStan's full-sized avatar
🎯
Focusing

Georgian Stan GeorgianStan

🎯
Focusing
View GitHub Profile
@GeorgianStan
GeorgianStan / delete.js
Last active May 5, 2020 07:15
Get selected options
this.notifications = this.notifications.filter(
(notification) => !idOfSelectedNotifications.includes(notification._id)
);
const _setAudioTime = (e, line) => {
let offset = 15, //15 because has a padding left of 15 px
clickedX = e.clientX - offset,
elementWidth = line.clientWidth,
percentClicked = clickedX * 100 / elementWidth,
audioDuration = _audioElem.duration;
let timeClicked = percentClicked * audioDuration / 100;
_audioCircle.style.left = percentClicked + '%';
/******************************************************************************
Read Temperature and Humidity
DHT22 Hardware Connections (Breakoutboard to ESP32):
OUT to GPIO 0
- to GND
+ to 3.3V
******************************************************************************/
@GeorgianStan
GeorgianStan / main.js
Created February 11, 2020 19:26
Mongodb NodeJS Driver
const MongoClient = require("mongodb").MongoClient;
(async function() {
const newDbName = "my-new-db";
const newDbUser = "test";
const newDbPwd = "test";
const newCollection = "my-new-collection";
// ? Create a new user for a new database
console.time("CreateNewUser");
@GeorgianStan
GeorgianStan / FrontEnd.js
Last active August 5, 2019 09:04
JWT Ex
const whoAmI = async () => {
/**
* * 1. Create the query
* * 2. Send the query and get the response as object
* * 3. If there was an error then throw it
* * 4. Otherwise return the result
*/
// * 1
const query = "{ whoAmI { id profilePicture email confirmed } }";
@GeorgianStan
GeorgianStan / index.js
Created September 8, 2018 07:46
React - Vanilla JS
// where the magic happens
function createElement(type, props, text) {
const elem = document.createElement(type);
Object.keys(props).forEach(prop => elem[prop] = props[prop] );
const textNode = document.createTextNode(text);
elem.appendChild(textNode);
return elem
@GeorgianStan
GeorgianStan / 2waydatabinding.js
Last active September 8, 2018 07:29
2-Way-DataBinding-JS
"use strict";
let scope = {};
(function twoWayDataBinding() {
let bindingItems = document.querySelectorAll('[tw-binding]');
// loop through all bindable elements
bindingItems.forEach((e) => {