Skip to content

Instantly share code, notes, and snippets.

Doug Vanderweide dougvdotcom

Block or report user

Report or block dougvdotcom

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dougvdotcom
dougvdotcom / 2-ftp-vms-ilb.azuredeploy.json
Last active May 22, 2019
Create two Azure VMs in an availability set, with an internal load balancer, with PASV FTP ports enabled
View 2-ftp-vms-ilb.azuredeploy.json
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName": {
"type": "string",
"metadata": {
"description": "Name of storage account"
}
},
@dougvdotcom
dougvdotcom / 2-ftp-vms-ilb.azuredeploy.parameters.json
Last active Mar 31, 2019
parameters file for 2-ftp-vms-ilb.azuredeploy.json
View 2-ftp-vms-ilb.azuredeploy.parameters.json
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName": {
"value": "dvftpstorage"
},
"adminUsername": {
"value": "dvroot"
},
@dougvdotcom
dougvdotcom / randomimage2.php
Created Nov 25, 2018
Select and displays a random image from a directory
View randomimage2.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--
Displaying A Random Image From A Directory Via PHP, Part 2
Copyright 2007 Doug Vanderweide
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@dougvdotcom
dougvdotcom / randomimage.php
Created Nov 25, 2018
Selects and passes along a random image from a directory.
View randomimage.php
<?
/*
Displaying A Random Image From A Directory Via PHP
Copyright 2007 Doug Vanderweide
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@dougvdotcom
dougvdotcom / randomimage.php
Created Nov 25, 2018
Selects and passes along a random image from a directory.
View randomimage.php
<?
/*
Displaying A Random Image From A Directory Via PHP
Copyright 2007 Doug Vanderweide
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@dougvdotcom
dougvdotcom / randomimage.php
Created Nov 25, 2018
Selects and passes along a random image from a directory.
View randomimage.php
<?
/*
Displaying A Random Image From A Directory Via PHP
Copyright 2007 Doug Vanderweide
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@dougvdotcom
dougvdotcom / redirect.php
Created Nov 25, 2018
Simple form and PHP to redirect user to a new webpage on form postback
View redirect.php
<?
if(isset($_POST['submit'])) {
$loc = "Location: " . $_POST['newPage'];
header($loc);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
Going To A New URL Via A Drop-Down List: JavaScript And DOM, PHP, ASP.NET
@dougvdotcom
dougvdotcom / get_time.php
Created Nov 25, 2018
Scrapes a USNO Web page for the current time
View get_time.php
<?
/*
Syncronizing A Web Page's JavaScript Clock Via AJAX / DOM
Copyright 2007 Doug Vanderweide
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@dougvdotcom
dougvdotcom / count_letters_in_string.php
Created Nov 25, 2018
Sometimes, we need to know how many of each character is in a string. This PHP code does just that.
View count_letters_in_string.php
<?
function getLetterCount($input) {
$letters = array();
//make lowercase to simplify counting
$temp = strtolower(trim($input));
//get length of string
$templen = strlen($temp);
@dougvdotcom
dougvdotcom / windows-azure-storage.php
Last active Oct 15, 2018
WordPress plugin to fix responsive images, credit Project Nami. Adapted to conform to WordPress coding standards.
View windows-azure-storage.php
<?php
/*
Plugin Name: Azure WordPress Storage Responsive Images Fix
Plugin URI: http://projectnami.org/fix-for-azure-storage-plugin-and-wp-4-4/
Description: Corrects srcset URLs for responsive images in a Scalable WordPress install running on Microsoft Azure.
Author: Project Nami / Doug Vanderweide
Version: 0.1
Author URI: https://www.dougv.com/2016/01/fixing-wordpress-4-4-responsive-images-in-azure-scalable-wordpress-installs/
License: GNU GPL 2
*/
You can’t perform that action at this time.