To Login
ssh -i <private-key-file/pem> ec2-user@[ec2-hostname].amazonaws.com
- Install Node JS & pm2 Ref:
/** | |
* 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
locale = { | |
en: { | |
activerecord: { | |
models: {}, | |
attributes: {} | |
} | |
} | |
} | |
exclude = [ |
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) | |
} |
query IntrospectionQuery { | |
__schema { | |
queryType { name } | |
mutationType { name } | |
types { | |
...FullType | |
} | |
directives { | |
name | |
description |
//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 | |
} |
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') |
require 'git' | |
g = Git.open('./') | |
g.branch('staging').checkout | |
report = [] | |
log = g.log(900000000) | |
log.each {|commit| | |
next unless commit.commit? | |
e = commit.date |
# rake monetize:verify | |
namespace :monetize do | |
desc "Verifies if all monetize attributes are set" | |
task verify: :environment do | |
ActiveRecord::Base.connection.tables.sort.map do |model| | |
next if %w(schema_migrations ar_internal_metadata versions).include?(model) | |
puts "Scanning: #{model}" | |