This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this gist is for eng.adnan about jwt | |
// first of all use this packge jsonwebtoken | |
// you can download it simply by typing this in your cmd : | |
//npm install jsonwebtoken | |
// ==========================// | |
// how to create tokens (login) | |
var user = await User.findOne({email:data.email}).exec(); //get user from database by email | |
if(user.validatePassword(data.password)){ // check password | |
var Token = jwt.sign({_id:user._id}, // generate token for and storing user id and expiration period |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def firstNonRepeatingLetter(word): | |
for char in word: | |
if word.lower().count(char.lower()) == 1 : | |
return char | |
return "" | |
# manuel Testing | |
print(firstNonRepeatingLetter("sTreSS")) | |
print(firstNonRepeatingLetter("sdasddd")) | |
print(firstNonRepeatingLetter("wWw")) |