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 / 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 / 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 / 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 / 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 / DateTimeExtensions.cs
Created November 5, 2018 18:38
A DateTime extension to show a friendly date based on the value passed in and DateTime.Now
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
jasongaylord / Default.cshtml
Created November 5, 2018 21:31
Twitter View Component
@model List<TwitterViewComponent.Tweet>
<h3>Recent Tweets</h3>
<ul>
@foreach (var tweet in Model)
{
<li>
@tweet.Message<br/>
<a href="http://twitter.com/@tweet.Username/statuses/@tweet.Id">@(tweet.Timestamp)</a>
</li>
@model List<TwitterViewComponent.Tweet>
<h3>Recent Tweets</h3>
<ul>
@foreach (var tweet in Model)
{
<li>
@tweet.Message<br/>
<a href="http://twitter.com/@tweet.Username/statuses/@tweet.Id">@(tweet.Timestamp)</a>
</li>
{
"TwitterOptions": {
"Username": "jgaylord",
"ConsumerKey": "YOUR_KEY",
"ConsumerSecret": "YOUR_SECRET"
},
"Logging": {
"LogLevel": {
"Default": "Warning"
}
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
@await Component.InvokeAsync("RetrieveTweets", new { })
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection.Extensions;
using TwitterViewComponent;
namespace Microsoft.Extensions.DependencyInjection
{
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddTwitter(this IServiceCollection services, IConfiguration configuration = null)
{