Skip to content

Instantly share code, notes, and snippets.

View jalbertbowden's full-sized avatar

albert jalbertbowden

View GitHub Profile
@jalbertbowden
jalbertbowden / TSQL2JSON
Created August 10, 2019 16:05
Use PHP to connect to MS SQL Server and convert results to JSON
<?php
/*
* Script to connect to MS SQL Server using
* SQL Server Authentication not Win Domain Auth.
* Return tabular results and convert to JSON.
* Colin A. White - October 2014
*/
/* Setup Connection Credentials */
@jalbertbowden
jalbertbowden / domIsReady.js
Created August 6, 2019 12:32 — forked from devbyray/domIsReady.js
Vanilla JavaScript Document Ready (Cross-Browser)
var domIsReady = (function(domIsReady) {
var isBrowserIeOrNot = function() {
return (!document.attachEvent || typeof document.attachEvent === "undefined" ? 'not-ie' : 'ie');
}
domIsReady = function(callback) {
if(callback && typeof callback === 'function'){
if(isBrowserIeOrNot() !== 'ie') {
document.addEventListener("DOMContentLoaded", function() {
return callback();
@jalbertbowden
jalbertbowden / php_mailer.php
Created August 5, 2019 06:13 — forked from andrewflash/php_mailer.php
Using PHP Mailer to Send HTML Emails with Images
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp1.example.com;smtp2.example.com";
$mail->SMTPAuth = true;
$mail->Username = 'smtpusername';
$mail->Password = 'smtppassword';
$mail->From="[email protected]";
@jalbertbowden
jalbertbowden / kill-browsers.bat
Last active August 6, 2019 17:21
Scripts for turning off Firefox and Edge on Windows after idle time.
@echo off
for /f "tokens=1 delims=" %%# in ('qprocess^|find /i /c /n "MicrosoftEdg"') do (
set count=%%#
)
taskkill /F /IM MicrosoftEdge.exe /T
taskkill /F /IM firefox.exe /T
pause
function get_publisher( WP_REST_Request $request ) {
$publisher_id = null;
$params = $request->get_params();
if (isset($params['id'])) { // get the id parameter
$publisher_id = $params['id'];
};
// imagine code that gets the record from the database; assuming the code from the database returns $publisher
if ( empty( $publisher ) ) { // return a 404 response
return new WP_Error( 'page_does_not_exist', __('The page you are looking for does not exist'), array( 'status' => 404 ) );
};
@jalbertbowden
jalbertbowden / map.geojson
Last active July 24, 2019 23:37
Virginia (Area) Obstructions Data - AWOIS Wrecks and Obstructions Database https://www.nauticalcharts.noaa.gov/data/wrecks-and-obstructions.html
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jalbertbowden
jalbertbowden / map.geojson
Last active July 24, 2019 23:18
Virginia Wrecks Data - Wrecks and Obstructions Database https://www.nauticalcharts.noaa.gov/data/wrecks-and-obstructions.html
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jalbertbowden
jalbertbowden / get-idle-time.ps1
Last active July 23, 2019 14:39
Powershell Script calling Batch Script to kill Firefox and Chrome running in Windows.
Add-Type @'
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace PInvoke.Win32 {
public static class UserInput {
[DllImport("user32.dll", SetLastError=false)]
private static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);
[StructLayout(LayoutKind.Sequential)]
private struct LASTINPUTINFO {
@jalbertbowden
jalbertbowden / URLs.txt
Created July 22, 2019 15:18
PowerShell Scripts
https://mail.google.com/mail/u/0/#inbox
https://docs.google.com/document/d/1hOc4bdEQ1-KJ5wOsiCt4kVQB-xaHuciQY6Y4X_I7dYA/edit
https://www.google.com/maps/
https://twitter.com/
https://onedrive.live.com/edit.aspx?cid=740de493111072ca&page=view&resid=740DE493111072CA!108&parId=740DE493111072CA!106&app=PowerPoint
https://outlook.live.com/mail/inbox
https://www.dropbox.com/h
https://www.nytimes.com/
https://www.nbcnews.com/
https://edition.cnn.com/