This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pulling the data from the db | |
@active_record_objects = ActiveRecordObject.where(is_something: [false, nil]) | |
# Turning the data into hashes for your own purposes | |
hashes = @active_record_objects.map do |object| | |
{ name: object.vendor.name, | |
data1: object.data1, | |
data2: object.data2, | |
data3: object.data3 } | |
end | |
# Generating the csv file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----------- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" |