Skip to content

Instantly share code, notes, and snippets.

ButlerFuqua

View GitHub Profile
View sign user up php mysql
<?php
$link = mysqli_connect("HOST", "USERNAME", "PASSWORD", "DATABASENAME");
if(mysqli_connect_error()){
die("There was an error connecting to the database.");
}
if($_POST){
View update user in database php mysql
<?php
$link = mysqli_connect("HOST", "USERNAME", "PASSWORD", "DATABASE");
if(mysqli_connect_error()){
die("There was an error connecting to the database.");
}
View connect and query a database php
<?php
$link = mysqli_connect("HOSTNAME", "DATABSEUSERNAME", "PASSWORD", "DATABASE");
if(mysqli_connect_error()){
die("There was an error connecting to the database.");
}
$query = "SELECT * FROM users";
View SearchForParentWithClassVanilla
function findAncester(el, cls) {
while (((el = el.parentElement) && !el.classList.contains(cls)) || el.tagName === "BODY");
return el;
}
@ButlerFuqua
ButlerFuqua / regExCharacterReference
Last active Feb 11, 2019
Reference of some common regular expression meta characters
View regExCharacterReference
let re;
// Literal Characters
re = /hello/;
re = /hello/i;
// Metacharacter Symbols
re = /^h/i; // Must start with
re = /world$/i; // Must end with
re = /^hello$/i; // Must begin and end with
@ButlerFuqua
ButlerFuqua / regExMethodReference.js
Created Feb 10, 2019
Reference for regular expression methods
View regExMethodReference.js
let re;
re = /hello/;
re = /hello/i; // i = case insensitive
// re = /hello/g; // Global search
// console.log(re);
// console.log(re.source);
// exec() - Return result in an array or null
// const result = re.exec(`hello world`);
View killNodeCommands.txt
https://tips.tutorialhorizon.com/2015/10/19/list-running-processes-in-terminal-filter-and-kill-them-if-required/
To find all instances of node running:
ps -a | grep node
-a means all, 'node' means all node instances.
The PID is the first number. The below kills it:
You can’t perform that action at this time.