$argon2id$v=19$m=512,t=256,p=1$pH8YIfNgZSnwV1nGzNigeA$n4g2F5BKQVQpZlnlUDQLBa1J2zE9YfMxC/BvATO9xyo
This file contains 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
/** | |
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken | |
* It was requested to be introduced at as part of the jsonwebtoken library, | |
* since we feel it does not add too much value but it will add code to mantain | |
* we won't include it. | |
* | |
* I create this gist just to help those who want to auto-refresh JWTs. | |
*/ | |
const jwt = require('jsonwebtoken'); |
To Login
ssh -i <private-key-file/pem> ec2-user@[ec2-hostname].amazonaws.com
- Install Node JS & pm2 Ref:
This file contains 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
locale = { | |
en: { | |
activerecord: { | |
models: {}, | |
attributes: {} | |
} | |
} | |
} | |
exclude = [ |
This file contains 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
const generateHash = require('object-hash') | |
const randomColor = require('randomcolor') | |
const similarity = {} | |
const uniqRandomColor = (options = {}) => { | |
let color = randomColor(options) | |
while (Object.values(similarity).includes(color)) { | |
color = randomColor(options) | |
} |
This file contains 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
query IntrospectionQuery { | |
__schema { | |
queryType { name } | |
mutationType { name } | |
types { | |
...FullType | |
} | |
directives { | |
name | |
description |
This file contains 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
//dbPlugins.js | |
import mongoose from 'mongoose' | |
export const hasMany = (schema, options) => { | |
for (const [className, finder] of Object.entries(options)) { | |
const plural = schema.base._pluralize(className) | |
schema.methods[plural] = function (cb) { | |
for (const [k, v] of Object.entries(finder)) { | |
finder[k] = v.toString()[0] === '$' ? this.get(v.replace('$', '')) : v | |
} |
This file contains 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
const { ApolloServer, gql } = require('apollo-server') | |
const { RESTDataSource } = require('apollo-datasource-rest') | |
class CountriesAPI extends RESTDataSource { | |
constructor() { | |
super() | |
this.baseURL = 'https://restcountries.eu/rest/v2' | |
} | |
async getAllCountries() { | |
return this.get('/all') |
This file contains 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
require 'git' | |
g = Git.open('./') | |
g.branch('staging').checkout | |
report = [] | |
log = g.log(900000000) | |
log.each {|commit| | |
next unless commit.commit? | |
e = commit.date |
NewerOlder