Skip to content

Instantly share code, notes, and snippets.

View ButlerFuqua's full-sized avatar

Butler Fuqua ButlerFuqua

View GitHub Profile
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:
@ButlerFuqua
ButlerFuqua / regExMethodReference.js
Created February 10, 2019 20:52
Reference for regular expression methods
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`);
@ButlerFuqua
ButlerFuqua / regExCharacterReference
Last active February 11, 2019 11:01
Reference of some common regular expression meta characters
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
function findAncester(el, cls) {
while (((el = el.parentElement) && !el.classList.contains(cls)) || el.tagName === "BODY");
return el;
}
<?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";
<?php
$link = mysqli_connect("HOST", "USERNAME", "PASSWORD", "DATABASE");
if(mysqli_connect_error()){
die("There was an error connecting to the database.");
}
<?php
$link = mysqli_connect("HOST", "USERNAME", "PASSWORD", "DATABASENAME");
if(mysqli_connect_error()){
die("There was an error connecting to the database.");
}
if($_POST){
if (document.readyState !== 'loading') {
readyFunction();
} else {
document.addEventListener('DOMContentLoaded', function () {
readyFunction();
});
}
function readyFunction(){
//
// https://github.com/GeekyAnts/vue-native-core/issues/117
//In app.json put:
"sourceExts": [
"js",
"json",
"ts",
"tsx",
"jsx",
"vue"
/**
* Add REST API for BBPress
* /
* Thanks to Barry at https://bbpress.org/forums/topic/is-there-an-api-for-bbpress/
*/
function bbpress_enable_rest_api() {
$types = array(
bbp_get_reply_post_type(),
bbp_get_forum_post_type(),
bbp_get_topic_post_type(),