Skip to content

Instantly share code, notes, and snippets.

@KHCode
KHCode / h-tag-font-sizes.css
Created August 4, 2023 16:34
Default Heading Tag Font Sizes
/* Heading tags are set with em units */
/* Most modern browsers set 1em equal to 16px */
/* Feel free to copy this file to customize your heading tags */
h1 {
font-size: 2em; /* 32px */
}
h2 {
font-size: 1.5em; /* 24px */
@KHCode
KHCode / bem.txt
Last active August 4, 2023 16:14
Summary of BEM Naming Methodology
BEM Naming Methodology For CSS
B is for Block.
Block is another word for component, as in web component, in this context.
Each block has a unique name.
Examples: ".card", ".hero", ".nav", ".header", ".footer"
E is for Elements.
Elements of a block are the same as descendents of a component in this context.
Blocks can have many elements.
@KHCode
KHCode / git-recipes.txt
Last active April 16, 2024 21:40
Git Recipes
----------- Rebasing onto common branch when working with others ----------------------------------------
git fetch origin develop:develop # instead of checkout develop, pull develop, checkout feature/...
git rebase develop
git push --force-with-lease
---------------------------------------------------------------------------------------------------------
----------- Pulling down a single file from the remote repo ---------------------------------------------
git checkout origin/develop -- path/to/filename
# Use this a lot when I run a migration from another dev's recent merge and I need to clean up the schema
@KHCode
KHCode / index.js
Created February 17, 2021 22:53
A very simple Node/Express app, to get you started
const express = require('express'); //Import the express dependency
const app = express(); //Instantiate an express app, the main work horse of this server
const port = 5000; //Save the port number where your server will be listening
//Idiomatic expression in express to route and respond to a client request
app.get('/', (req, res) => { //get requests to the root ("/") will route here
res.sendFile('index.html', {root: __dirname}); //server responds by sending the index.html file to the client's browser
//the .sendFile method needs the absolute path to the file, see: https://expressjs.com/en/4x/api.html#res.sendFile
});
@KHCode
KHCode / index.html
Last active May 8, 2023 19:36
A very simple html file to get you started.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello World Simple App</title>
</head>
<body>
<div>Hello World!</div>
@KHCode
KHCode / package.json
Created February 16, 2021 04:08
This is an example of what a package.json file looks like before you start adding dependencies
{
"name": "simple-node-server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Kris Hill",
"license": "ISC"