Skip to content

Instantly share code, notes, and snippets.

View bradtraversy's full-sized avatar
💭
Always Coding :)

Brad Traversy bradtraversy

💭
Always Coding :)
View GitHub Profile
@bradtraversy
bradtraversy / npmcrashcourse.txt
Last active September 29, 2024 21:04
NPM Crash Course Commands
# GET VERSION
npm -v (or --version)
# GET HELP
npm help
npm
# CREATE PACKAGE.JSON
npm init
npm init -y (or --yes)
@bradtraversy
bradtraversy / pdocrash.php
Last active November 15, 2024 04:19
PDO & Prepared Statements Snippets
<?php
$host = 'localhost';
$user = 'root';
$password = '123456';
$dbname = 'pdoposts';
// Set DSN
$dsn = 'mysql:host='. $host .';dbname='. $dbname;
// Create a PDO instance
@bradtraversy
bradtraversy / dtcrashcourse.html
Last active July 25, 2023 11:36
Code From the Developer Tools Crash Course
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<title>Devtools Test</title>
</head>
<body>
# GET VERSION
yarn -v (or --version)
# GET HELP
yarn help
# CREATE PACKAGE.JSON
yarn init
yarn init -y // Use defaults
@bradtraversy
bradtraversy / pdo_db.php
Created February 21, 2018 12:56
PDO Class
<?php
/*
* PDO DATABASE CLASS
* Connects Database Using PDO
* Creates Prepeared Statements
* Binds params to values
* Returns rows and results
*/
class Database {
private $host = DB_HOST;
@bradtraversy
bradtraversy / sample.md
Created March 23, 2018 18:17
Markdown Cheat Sheet

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

This text is italic

@bradtraversy
bradtraversy / myscript.sh
Last active November 9, 2024 02:10
Basic Shell Scripting
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@bradtraversy
bradtraversy / ssh.md
Last active October 22, 2024 15:35
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh [email protected]

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

@bradtraversy
bradtraversy / webdev_online_resources.md
Last active November 5, 2024 12:03
Online Resources For Web Developers (No Downloading)
@bradtraversy
bradtraversy / blogscraping.py
Created July 29, 2018 12:02
Simple scraping of a blog
import requests
from bs4 import BeautifulSoup
from csv import writer
response = requests.get('http://codedemos.com/sampleblog/')
soup = BeautifulSoup(response.text, 'html.parser')
posts = soup.find_all(class_='post-preview')