Skip to content

Instantly share code, notes, and snippets.

View yasinatesim's full-sized avatar
🎯
Focusing

Yasin ATEŞ yasinatesim

🎯
Focusing
View GitHub Profile
@codemile
codemile / useWndFocus.tsx
Created June 25, 2021 10:39
Hook that emits when the window has focus.
import {useEffect, useState} from 'react';
export const useWndFocus = () => {
const [focus, setFocus] = useState(document.hasFocus());
useEffect(() => {
const onFocus = () => setFocus(true);
const onBlur = () => setFocus(false);
window.addEventListener('focus', onFocus);
window.addEventListener('blur', onBlur);
return () => {
@samsch
samsch / stop-using-jwts.md
Last active April 23, 2024 05:47
Stop using JWTs

Stop using JWTs!

TLDR: JWTs should not be used for keeping your user logged in. They are not designed for this purpose, they are not secure, and there is a much better tool which is designed for it: regular cookie sessions.

If you've got a bit of time to watch a presentation on it, I highly recommend this talk: https://www.youtube.com/watch?v=pYeekwv3vC4 (Note that other topics are largely skimmed over, such as CSRF protection. You should learn about other topics from other sources. Also note that "valid" usecases for JWTs at the end of the video can also be easily handled by other, better, and more secure tools. Specifically, PASETO.)

A related topic: Don't use localStorage (or sessionStorage) for authentication credentials, including JWT tokens: https://www.rdegges.com/2018/please-stop-using-local-storage/

The reason to avoid JWTs comes down to a couple different points:

  • The JWT specification is specifically designed only for very short-live tokens (~5 minute or less). Sessions
@bradtraversy
bradtraversy / webdev_online_resources.md
Last active May 3, 2024 12:56
Online Resources For Web Developers (No Downloading)
@jacklorusso
jacklorusso / workbench.colorCustomizations.json
Last active December 19, 2023 07:40
A list of all Visual Studio Code customizable colors, grouped by UI region. Copy and paste into User Settings (comments are allowed) to tweak an existing theme or work on your own.
"workbench.colorCustomizations": {
// Contrast Colors - The contrast colors are typically only set for high contrast themes. If set, they add an additional border around items across the UI to increase the contrast.
"contrastActiveBorder": "",
"contrastBorder": "",
// Base Colors
"focusBorder": "",
"foreground": "",
"widget.shadow": "",
"selection.background": "",
"descriptionForeground": "",
@mikalv
mikalv / lstm_text_generator.py
Created September 6, 2017 22:34 — forked from MBoustani/lstm_text_generator.py
Simple Tensorflow RNN LSTM text generator
import tensorflow as tf
import numpy as np
#set hyperparameters
max_len = 40
step = 2
num_units = 128
learning_rate = 0.001
batch_size = 200
epoch = 60
@MBoustani
MBoustani / lstm_text_generator.py
Last active April 2, 2022 20:14
Simple Tensorflow RNN LSTM text generator
import tensorflow as tf
import numpy as np
#set hyperparameters
max_len = 40
step = 2
num_units = 128
learning_rate = 0.001
batch_size = 200
epoch = 60
@FrancesCoronel
FrancesCoronel / sampleREADME.md
Last active March 26, 2024 01:21
A sample README for all your GitHub projects.

Repository Title Goes Here

Frances Coronel

INSERT GRAPHIC HERE (include hyperlink in image)

Subtitle or Short Description Goes Here

ideally one sentence >

@PurpleBooth
PurpleBooth / README-Template.md
Last active May 6, 2024 07:22
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@Eomerx
Eomerx / validate-tc-id.js
Last active October 13, 2022 17:47
Validate TC ID
//=======================================
// CHECK TC ID =
//=======================================
var checkTcNum = function(value) {
value = value.toString();
var isEleven = /^[0-9]{11}$/.test(value);
var totalX = 0;
for (var i = 0; i < 10; i++) {
totalX += Number(value.substr(i, 1));
}
@whizark
whizark / class-naming-convention.md
Last active April 23, 2024 06:25
HTML/CSS Class Naming Convention #html #css #sass