View 0_reuse_code.js
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View precommit
#!/usr/bin/env bash | |
TEXT_DEFAULT="\\033[0;39m" | |
TEXT_INFO="\\033[1;32m" | |
TEXT_ERROR="\\033[1;31m" | |
TEXT_YELLOW="\\033[1;33m" | |
echo -e "$TEXT_YELLOW""[ >>> PRE-COMMIT START ]""$TEXT_DEFAULT" | |
FILES_PATTERN='(\..+)?$' |
View loop-multisite.sh
#!/bin/bash | |
for site in `wp site list --field=url`; do | |
wp media regenerate --yes --url=$site | |
done | |
~ |
View romsync.py
#!/usb/bin/env python | |
import os | |
import dropbox | |
import shutil | |
import zipfile | |
# Create a dropbox app and obtain App Key and Secret Key. Specify a folder | |
# Create a folder called romsync in your specified Dropbox app folder | |
# Store Dropbox App Key and Secret Key in system environment variables |
View wpApiGetUsers.php
<?php | |
$wp = new GuzzleHttp\Client(); | |
$request = $wp->get('http://www.example.com/wp-json/wp/v2/users'); | |
$statusCode = $request->getStatusCode(); | |
if($statusCode >= 200 && $statusCode < 300 ) { | |
$users = json_decode($request->getBody()); | |
foreach($users as $user) { | |
//var_dump($user->id); | |
//var_dump($user->name); | |
//var_dump($user->slug); |
View generatecert.sh
#!/bin/bash | |
# Usage: generatecert.sh domainname.dev | |
# Generates a key and self signed certificate, then requires Linux Chrome to trust the certificate | |
# Dependency: libnss3-tools (sudo apt install libnss3-tools) | |
if (( $EUID != 0 )); then | |
echo "Please run again with sudo" | |
exit | |
fi |
View BlogController.php
<?php | |
class BlogController extends Controller | |
{ | |
/** | |
* Posts | |
* | |
* @return void | |
*/ | |
public function showPosts() |
View forge-nginx-wp-multisite.conf
# THis is for WordPress subdirectory multsite | |
rewrite ^/(wp-.*.php)$ /wp/$1 last; | |
rewrite ^/(wp-(content|admin|includes).*) /wp/$1 last; | |
if (!-e $request_filename) { | |
rewrite /wp-admin$ $scheme://$host$uri/ permanent; | |
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) /wp$1 last; | |
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ /wp$1 last; | |
} |
View downloadpdf.conf
location ~* /(.*\.pdf) { | |
types { application/octet-stream .pdf; } | |
default_type application/octet-stream; | |
} |
OlderNewer