Skip to content

Instantly share code, notes, and snippets.

View luishrd's full-sized avatar
🏠
Working from home

Luis Hernandez luishrd

🏠
Working from home
View GitHub Profile
select customers.CustomerName, customers.Country, orders.OrderId, orders.OrderDate
from orders inner join customers on orders.CustomerId = customers.CustomerId
select orders.OrderId, orders.OrderDate, employees.FirstName, employees.LastName
from orders
inner join employees on orders.employeeId = employees.employeeId
// inside /api
const express = require('express');
const hobbitRoutes = require('./hobbits/hobbitRoutes');
// const server = express(); full app
const api = express.Router();
// middleware
@luishrd
luishrd / User.js
Created June 21, 2018 18:29
CS10 - Server Testing
// ./users/User.js
const mongoose = require('mongoose');
const bcrypt = require('bcrypt');
const userSchema = new mongoose.Schema({
username: {
type: String,
unique: true,
},
@luishrd
luishrd / App.js
Created June 20, 2018 18:20
CS10 - React Testing
// src/App.js
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Header from './components/Header';
class App extends Component {
render() {
@luishrd
luishrd / notes.md
Last active July 9, 2018 06:20
CS10 - Testing

(Automated) Testing

Day 1

  • why?
  • how?
  • what? comes from experience and the system we're testing and even the tech stack.
  • when? test-first vs test after.

Why learn it?

@luishrd
luishrd / App.js
Last active July 18, 2019 02:43
CS10 - JWT Auth
// ./client/src/App.js
import React, { Component } from 'react';
import { Route, withRouter } from 'react-router-dom';
import logo from './logo.svg';
import './App.css';
import Signin from './auth/Signin';
import Users from './users/Users';
@luishrd
luishrd / UserModel.js
Last active July 9, 2018 06:20
CS10 - Auth with Sessions
// ./auth/UserModel.js
const mongoose = require('mongoose');
const bcrypt = require('bcrypt');
const userSchema = new mongoose.Schema({
username: {
type: String,
unique: true,
required: true,
@luishrd
luishrd / .gitignore
Created May 24, 2018 18:10
Server Testing
node_modules
.DS_Store
.vscode
@luishrd
luishrd / .gitignore
Last active June 27, 2018 16:40
React Testing
// /.gitignore
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
# testing
/coverage