Skip to content

Instantly share code, notes, and snippets.

@cklanac
cklanac / mac-setup.md
Last active February 26, 2024 04:17
Mac setup

Mac Setup Distilled

Install Chrome, Dev and Canary

Description of Chrome Channels

  • Install Chrome or Chrome Dev
    • Note: Chrome and Chrome Dev use the same profile on a Mac
  • Setup 2 profiles:
    • Browsing: It may contain bookmarks, personal settings and extenstions
@cklanac
cklanac / challenge-mocha-chai-travis.md
Last active February 6, 2024 22:48
Challenge 05: Testing with Mocha Chai

For this challenge you will create a full suite of tests that confirm your app is working correctly. Then you'll setup Continuous Integration to ensure your app continues to work.

Requirements

  • Install mocha, chai and chai-http
  • Update server.js to support tests
  • Create a suite of tests:
    • Test that the environment
    • Test the static server
  • Test the endpoints
@cklanac
cklanac / challenge-09-many-to-many.md
Last active December 23, 2023 02:52
Challenge 09: KnexJS with Many-to-Many

Noteful Challenge - Many-to-Many

In this challenge you will create a tags and notes_tags table which will setup a many-to-many relationship between notes and tags. You'll also create a new router to perform CRUD operations on the tags, and update the existing notes endpoints to work with tag related data.

Requirements

Add tags and notes_tags table and relationships

To get started, let's update the .sql script from the previous challenges. Create a tags table and define 2 fields in the schema.

@cklanac
cklanac / cicd-config-clicker.md
Last active June 8, 2023 04:11
CICD: Travis CI and Heroku Instructions: 2 Versions - Point-n-Click and CLI Ninja

Setup Travis and Heroku CICD: Point-n-Click

Continuous Integration with Travis CI

Configure travis.yml

  • Run npm test to ensure tests are working correctly locally
  • Create .travis.yml file in repo
  • Add the following to configure for node
@cklanac
cklanac / knexjs.joins.md
Created February 6, 2018 10:50
Knex.js Joins

Adding Knex to the endpoints

Now that you have a good understanding of the Knex's capabilities, let's look at adding Knex to our Express app endpoints. Quit the nodemon drills.js process and start the server.

Open Postman and navigate to http://localhost:8080/restaurants. You should get back a list of restaurants. The SELECT statement is straight forward, the only thing to point out is the addition of in the `.then(results => res.json(results) );

Inner Join

Let's tackle the grade first.

@cklanac
cklanac / defaults-write.sh
Last active September 19, 2022 21:42
Mac Setup Distilled
#!/usr/bin/env bash
# ~/.macos — https://mths.be/macos
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
@cklanac
cklanac / Javascript OO Cheat Sheet
Last active September 14, 2022 09:35
Javascript OO Cheat Sheet
/***********************************************************************************************************************
***********************************************************************************************************************
* CONTENTS:
* Native Object
* Object Literal
* Basic Object
* Psuedo-Class
* Self Executing/Invoking Structure
* Lazy Function
* Module Pattern
@cklanac
cklanac / #code_snippets.md
Last active August 5, 2022 17:48
Code Snippets for "The Firebase Realtime Database and Flutter - Firecasts"

Code Snippets for "Firebase Realtime Database and Flutter" https://www.youtube.com/watch?v=sXBJZD0fBa4

NOTES:

  • The files are ordered by timestamp in the video
  • Only the relevant code is provided. Imports have been removed
  • Sections not included:
    • Security Rules
    • Using the emulator
  • FirebaseAnimatedList
@cklanac
cklanac / logger.js
Created August 15, 2017 20:53
Morgan, Winston and Loggly
'use strict';
const { LOGGLY_TOKEN } = require('../config');
/**
* [Winston](https://github.com/winstonjs/winston)
* A multi-tranport async logging library
*
* Use winston to implement our logger, but the rest of the app uses
* the generic logger interface that we export. This decouples logging
* logic in our code from implementation with Winston.