Skip to content

Instantly share code, notes, and snippets.

Working remote and staying safe

Jason N. Gaylord jasongaylord

Working remote and staying safe
View GitHub Profile
jasongaylord / capslock.html
Last active Mar 22, 2021
A few JavaScript functions to detect if caps lock is on or not. More can be read about this at:
View capslock.html
<title>Test Caps Lock</title>
<div id="capsLockWarning" style="font-weight: bold; color: maroon; margin: 0 0 10px 0; display: none;">Caps Lock is on.</div>
Username: <input type="text" id="username" /><br/>
Password: <input type="password" id="password" />
<script language="javascript">
jasongaylord / IEUserAgentTest.html
Last active Jan 1, 2021
A sample JavaScript file to detect IE compatibility mode and version. This is not recommended unless absolutely needed as features should be detected instead.
View IEUserAgentTest.html
<!DOCTYPE html>
<html xmlns="">
<title>Testing IE Compatibility Mode</title>
<script src="ieUserAgent.js" type="text/javascript"></script>
<div id="results">Results:</div>
<script type="text/javascript">
var val = "IE" + ieUserAgent.version;
jasongaylord / pr-webhook-schema.json
Created Sep 23, 2020
GitHub WebHook API Pull Request Schema
View pr-webhook-schema.json
"type": "object",
"properties": {
"action": {
"type": "string"
"number": {
"type": "integer"
"pull_request": {
jasongaylord / beacon.html
Created Aug 27, 2020
Beacon CSS - An example using CSS animations to create a beacon for use on something like a map or to call attention visually.
View beacon.html
<html lang="en">
.dot {
background-color: red;
border-radius: 50%;
width: 20px;
height: 20px;
display: block;
jasongaylord / New-CName.ps1
Created Apr 29, 2019
A script to create a new CName on an existing zone in Azure. You can use this script in an Azure DevOps pipeline using a service account with the proper permissions.
View New-CName.ps1
# Subscription ID
[Parameter(Position=0, Mandatory=$true)]
# DNS Resource Group Name
[Parameter(Position=1, Mandatory=$true)]
jasongaylord / azure-pipelines.yml
Created Apr 11, 2019
Azure Pipelines - Build YAML file for HTML Copying
View azure-pipelines.yml
- master
name: $(Date:yyyyMMdd)$(Rev:.r)
vmImage: 'Ubuntu-16.04'
- task: CopyFiles@2
jasongaylord / youtube.cs
Created Feb 20, 2019
YouTube API Connection
View youtube.cs
public List<Google.Apis.YouTube.v3.Data.SearchResult> LatestVideos()
var youTubeService = new YouTubeService(
new BaseClientService.Initializer() {
ApplicationName = "{Project}",
ApiKey = "{API_key}"
var listRequest = youTubeService.Search.List("snippet");
jasongaylord / DateTimeExtensions.cs
Created Nov 5, 2018
A DateTime extension to show a friendly date based on the value passed in and DateTime.Now
View DateTimeExtensions.cs
public static class DateTimeExtensions
public static string ToFriendlyDate(this DateTime date)
// Calculate the elapsed time
TimeSpan s = DateTime.UtcNow.Subtract(date);
// Get total number of days elapsed.
int dayDiff = (int)s.TotalDays;
jasongaylord / droptables.sql
Created Nov 12, 2018
Drop All Cloudscribe Tables
View droptables.sql
drop table dbo.cs_UserToken;
drop table dbo.cs_UserRole;
drop table dbo.cs_UserLogin;
drop table dbo.cs_UserLocation;
drop table dbo.cs_UserClaim;
drop table dbo.cs_User;
drop table dbo.cs_SystemLog;
drop table dbo.cs_SiteHost;
drop table dbo.cs_Site;
drop table dbo.cs_Role;
View TwitterService.cs
public class TwitterService : ITwitterService
public string ObtainBearerToken(string consumerKey, string consumerSecret)
var applicationAuthorization = Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0}:{1}", Uri.EscapeDataString(consumerKey), Uri.EscapeDataString(consumerSecret))));
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("");
request.Headers.Add("Authorization", "Basic " + applicationAuthorization);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded;charset=UTF-8";