Skip to content

Instantly share code, notes, and snippets.

@mrfolkblues
mrfolkblues / facebook-share-dialog-example.html
Last active April 9, 2022 07:59
Facebook Share Dialog Example: Using Javascript to define custom sharing parameters
<script>
// Include the Facebook Javascript SDK
window.fbAsyncInit = function() {
FB.init({
appId : 'your-app-id',
xfbml : true,
version : 'v2.8' // Update version as necessary
});
FB.AppEvents.logPageView();
};
@mrfolkblues
mrfolkblues / vhost.py
Created December 30, 2016 17:13 — forked from fideloper/vhost.py
Create vHost Ubuntu Lamp-Server (bash and python)
#! /usr/bin/python
from sys import argv
from os.path import exists
from os import makedirs
from os import symlink
from os import system
import getopt
#
@mrfolkblues
mrfolkblues / window.location.origin-polyfill.txt
Last active January 31, 2019 20:39
window.location.origin Polyfill
if (!window.location.origin) {
window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');
}
@mrfolkblues
mrfolkblues / include-wordpress-functions.php
Created January 16, 2018 15:57
Include WordPress core functions without loading themes
<?php
// include WP core functions
define( 'WP_USE_THEMES', false );
require_once( 'wp-load.php' );
@mrfolkblues
mrfolkblues / prevent-scroll.js
Created January 16, 2018 20:38
Prevent different types of scrolling, with disable and enable functions
/* Prevent Different Types of scrolling */
// left: 37, up: 38, right: 39, down: 40,
// spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36
var keys = { 37: 1, 38: 1, 39: 1, 40: 1 };
function preventDefault(e) {
e = e || window.event;
console.log(e.target);
if (e.preventDefault) e.preventDefault();
e.returnValue = false;
@mrfolkblues
mrfolkblues / Vagrantfile
Last active August 23, 2019 16:22 — forked from ricardocanelas/VagrantFile
Vagrant / Ubuntu 14.04.5 + PHP 7.1 + MariaDB 10.1 + Apache 2.4.7
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Update your Vagrant install before using.
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network "private_network", ip: "192.168.71.71"
@mrfolkblues
mrfolkblues / LAMP-PHP5-6-setup.txt
Last active February 11, 2019 21:55
Setup instructions for creating a LAMP server that uses MariaDB 10 and PHP 5.6. Based on an Ubuntu 16.04 system on DigitalOcean.
# Initial Setup and install apache
apt-get update
apt-get -y install git curl vim
apt-get install -y apache2 libapache2-mod-fastcgi
a2enmod actions fastcgi rewrite
sudo service apache2 restart
# Edit /etc/apache2/sites-available/000-default.conf to add these lines:
<Directory "/var/www/html">
@mrfolkblues
mrfolkblues / safe-stringify.js
Created April 8, 2022 21:11
JSON stringify that safely handles circular references (found on StackOverflow somewhere)
// safely handles circular references
JSON.safeStringify = (obj, indent = 2) => {
let cache = []
const retVal = JSON.stringify(
obj,
(key, value) =>
typeof value === 'object' && value !== null
? cache.includes(value)
? undefined // Duplicate reference found, discard key
: cache.push(value) && value // Store value in our collection