Skip to content

Instantly share code, notes, and snippets.

View jasongaylord's full-sized avatar
⏲️
Trying to find time to code.

Jason N. Gaylord jasongaylord

⏲️
Trying to find time to code.
View GitHub Profile
@jasongaylord
jasongaylord / PackageVersion.ps1
Created January 25, 2018 16:48
VSTS - Set NuGet Package Version
$pkgver=$(Get-Date -Format 'yyyy.Mdd.Hmmss');
Write-Host "##vso[task.setvariable variable=pkgver]$pkgver"
@jasongaylord
jasongaylord / Cleanup.sql
Created June 28, 2017 17:43
Cleans all objects from a database except the procedure itself
create proc Cleanup
as
declare @n char(1)
set @n = char(10)
declare @stmt nvarchar(max)
-- procedures
@jasongaylord
jasongaylord / index.html
Created February 3, 2016 05:09 — forked from anonymous/index.html
JS Bin canvas.getContext() Sample // source http://jsbin.com/vujasi
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
<meta name="description" content="canvas.getContext() Sample">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
@jasongaylord
jasongaylord / IdentityConfig.cs
Created January 29, 2016 02:28
A partial IdentityConfig.cs snippet
public class ApplicationSignInManager : SignInManager<ApplicationUser, string>
{
public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager)
: base(userManager, authenticationManager)
{ }
public override Task SignInAsync(ApplicationUser user, bool isPersistent, bool rememberBrowser)
{
if (!user.EmailConfirmed)
{
@jasongaylord
jasongaylord / SecureStringHelper.cs
Last active January 16, 2016 02:06
A Helper method to convert a string value to a SecureString value. This is most useful when needing to pass a sensitive value, such as a social security number or password, around as a string on the server side. The SecureString class has a Dispose method for GC.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Web;
namespace Gaylord.Helpers
{
public static class SecureStringHelper
{
@jasongaylord
jasongaylord / capslock-jquery.html
Last active December 30, 2015 09:39
A jQuery version of the capslock.html GIST found at https://gist.github.com/jasongaylord/7797819.
<html>
<head>
<title>Test Caps Lock</title>
</head>
<body>
<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" />
</body>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
@jasongaylord
jasongaylord / capslock.html
Last active March 22, 2021 14:14
A few JavaScript functions to detect if caps lock is on or not. More can be read about this at:
<html>
<head>
<title>Test Caps Lock</title>
</head>
<body>
<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" />
</body>
<script language="javascript">
@jasongaylord
jasongaylord / BrowserFeatures.js
Last active December 18, 2015 05:38
This is an example snippet that demonstrates how to check for a feature and perform an action based on that detection. In this example, we are checking for the new getUserMedia() method. This method is not fully implemented as of the post date. Therefore, the HTML file is grabbing the feature specifically for the WebKit browsers.
// Check to see if jQuery is loaded. If not, load it from the public jQuery CDN.
if (typeof jQuery == 'undefined') {
// Load the latest jQuery library from jQuery
document.write("\<script src='http://code.jquery.com/jquery-latest.min.js' type='text/javascript'>\<\/script>");
}
// Create new BrowserFeatures object
var BrowserFeatures = {
init: function () {
// GetUserMedia
@jasongaylord
jasongaylord / IEUserAgentTest.html
Last active October 10, 2023 08:04
A sample JavaScript file to detect IE compatibility mode and version. This is not recommended unless absolutely needed as features should be detected instead.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Testing IE Compatibility Mode</title>
<script src="ieUserAgent.js" type="text/javascript"></script>
</head>
<body>
<div id="results">Results:</div>
<script type="text/javascript">
var val = "IE" + ieUserAgent.version;
@jasongaylord
jasongaylord / Theme.cs
Last active December 17, 2015 22:09
This class can be copied into any of your phone applications. I usually create a file called Theme.cs and paste it in there. In the App.xaml.cs file, update Application_Launching and Application_Activeated to call Theme.Detect(). This will call the static method called Detect which will, in turn, populate the properties listed. I've blogged abou…
public static class Theme
{
public static SolidColorBrush Foreground { get; private set; }
public static ThemeColor CurrentTheme { get; private set; }
public static bool IsLightTheme { get { return CurrentTheme == ThemeColor.Light; } }
public static bool IsDarkTheme { get { return CurrentTheme == ThemeColor.Dark; } }
public enum ThemeColor
{
Light,