Skip to content

Instantly share code, notes, and snippets.

View bradsi's full-sized avatar
🛠️
Building

Brad Singleton bradsi

🛠️
Building
View GitHub Profile
-- select all data
SELECT * FROM users;
-- select first two users
SELECT * FROM users LIMIT 2;
-- select specific columns
SELECT first_name from users;
-- alias columns
@bradsi
bradsi / snippet.sql
Last active April 1, 2021 12:46
SQL Commands that deal with the manipulation of data. - INSERT - UPDATE - DELETE
-- insert single entry into table
INSERT INTO users (first_name, last_name, email)
VALUES ('John', 'Smith', 'johnsmith@gmail.com');
-- insert multiple entries
INSERT INTO users (first_name, last_name, email)
VALUES ('John', 'Smith', 'johnsmith@gmail.com'),
('John', 'Doe', 'johndoe@gmail.com');
-- update
-- create db called users
CREATE DATABASE my_app;
-- delete db
DROP DATABASE my_app;
-- use db
USE my_app;
-- create table
<?php
// Connect to DB
class Dbh {
private $host = "";
private $user = "";
private $pwd = "";
private $dbName = "";
protected function connect(){
<?php
declare(strict_types = 1);
<?php
spl_autoload_register('autoLoader');
function autoLoader($className) {
$url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if (strpos($url, 'inc')) {
$path = '../classes/';
} else {
$path = 'classes/';
}
<?php
$password = "test123";
// Password hashing
$hash = password_hash($password, PASSWORD_DEFAULT);
// Password de-hashing - returns boolean
$dehash = password_verify($password, $hash);
<?php
// Define a class
class User {
// Properties
public $name;
// Constructor - runs when an object is instantiated
public function __construct($name) {
echo 'Class ' . __CLASS__ . ' instantiated<br>';
@bradsi
bradsi / main.txt
Last active July 14, 2020 09:52
Vimium Shortcuts
j - move down
d - move half page down
k - move up
u - move half page up
F - show shortcuts to click on links
link shortcut (lowercase) - open link in background tab
H - go back in history
L - go forward in history
J - go one tab left
K - go one tab right
@bradsi
bradsi / webdev_online_resources.md
Created July 26, 2018 12:47 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)