Skip to content

Instantly share code, notes, and snippets.

// a ‘dog’ object has the value of legs = 4. Create a new var named ‘fido’ as a
// ‘dog’ object. Set fido’s age as ‘3’ and output the number of legs that
// ‘fido’ has.
//
// ES5
var dog = {
legs: 4
};

Conduit Bending

90°

EMT Pipe Size Rigid Pipe Take up
1/2" (12.7mm) N/A 5" (127mm)
3/4" (19.1mm) 1/2" (12.7mm) 6" (153mm)
1" (25.4mm) 3/4" (19.1mm) 8" (203mm)
1 1/4" (31.8mm) 1" (25.4mm) 12" (305mm)
@natac13
natac13 / README.md
Created March 17, 2017 13:31
sendinblue email error

mailer.js

This file is the express.js route to handle the 'Contact Me' forum submission. Not sure if the client side code matters but I just send off an axios post call to the express route above, then return success (pop up confirmation) or the error message and display that.

Everything works in development but when I try it on digitalocean I get the error in errorMessage. Could there be something I have done incorrectly with regards to server setup. The tutorials I have used to help me are as follows: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04 https://code.lengstorf.com/deploy-nodejs-ssl-digitalocean/#install-nginx

@natac13
natac13 / media-query.css
Created March 18, 2019 09:56 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
const zipManyWith = curry((fn, ars) => {
const n = Math.min(...map(length, ars));
return map((i) => {
return fn(...map((as) => as[i], ars));
}, range(0, n));
});
@natac13
natac13 / session.md
Last active April 20, 2019 17:40
Authentication Work Flow

Authentication Work Flow

Sesssions


Flow

  • user submits login credentials, e.g email and password
  • server verifies the credentials against the DB
  • server creates a temporary user session
  • server issues a cookie with a session ID
  • user sends the cookie with each request
@natac13
natac13 / Build.md
Created April 21, 2019 18:37
Project Setup

Build Process

Automated sequence of tasks that runs on eash push, tag, and/or release

Stages

  1. install
  2. lint
  3. test
  4. build
  5. push
@natac13
natac13 / MongoDB_Knowledge.md
Created April 22, 2019 10:55
My working understanding of MongoDB and the tools surrounding it. eg Atlas, mlab, mongoose

Structuring a Mongo Database Documents

Whether or not one should embed nested docs or to use the reference by ID and populate later is a great question and has been answered nicely on StackOverflow

@natac13
natac13 / classesResolver.js
Created May 7, 2019 14:50
Dataloader & The Problem it solves. My understaning.
....
export default {
Query: {
class: () => {...}
},
classes: async (root, { conditions }, { dataSources, userId }, info) => {
// Check for authentication
...
const projection = gqlMongoDBProjection(info);
return dataSources.Class.getAllClasses(conditions, projection);
@natac13
natac13 / setup-x509.sh
Created May 18, 2019 15:25 — forked from tjworks/setup-x509.sh
Script to setup a test MongoDB replicaset and enable X.509 authentication
### https://github.com/tjworks/mongoscripts/tree/master/x509 ###
# Prerequisites:
# a. Make sure you have MongoDB Enterprise installed.
# b. Make sure mongod/mongo are in the executable path
# c. Make sure no mongod running on 27017 port, or change the port below
# d. Run this script in a clean directory
##### Feel free to change following section values ####
# Changing this to include: country, province, city, company
dn_prefix="/C=CN/ST=GD/L=Shenzhen/O=MongoDB China"