This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIT License | |
Copyright (c) 2022 Matt Johnson-Pint | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Net.Http; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace HttpClientProgress { | |
public static class HttpClientProgressExtensions { | |
public static async Task DownloadDataAsync (this HttpClient client, string requestUrl, Stream destination, IProgress<float> progress = null, CancellationToken cancellationToken = default (CancellationToken)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ country: 'Australia', code: 'AU' }, | |
{ country: 'Austria', code: 'AT' }, | |
{ country: 'Belgium', code: 'BE' }, | |
{ country: 'Brazil', code: 'BR' }, | |
{ country: 'Bulgaria', code: 'BG' }, | |
{ country: 'Canada', code: 'CA' }, | |
{ country: 'Croatia', code: 'HR' }, | |
{ country: 'Cyprus', code: 'CY' }, | |
{ country: 'Czech Republic', code: 'CZ' }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @Object AS INT; | |
DECLARE @ResponseText AS VARCHAR(8000); | |
DECLARE @Body AS VARCHAR(8000) = | |
'{ | |
"what": 1, | |
"ever": "you", | |
"need": "to send as the body" | |
}' | |
EXEC sp_OACreate 'MSXML2.XMLHTTP', @Object OUT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT LOWER(REPLACE(NEWID(),'-','')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert the DOM element to a drawing using kendo.drawing.drawDOM | |
kendo.drawing.drawDOM($(".qr-wrapper")) //#qrMail | |
.then(function(group) { | |
// Render the result as a PNG image | |
return kendo.drawing.exportImage(group); | |
}) | |
.done(function(data) { | |
// Save the image file | |
kendo.saveAs({ | |
dataURI: data, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"event": "send", | |
"msg": { | |
"ts": 1365109999, | |
"subject": "This an example webhook message", | |
"email": "[email protected]", | |
"sender": "[email protected]", | |
"tags": [ | |
"webhook-example" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FluentNHibernate.Cfg; | |
using FluentNHibernate.Cfg.Db; | |
using NHibernate; | |
using NHibernate.Cfg; | |
/// <summary> | |
/// NHibernate Helper | |
/// </summary> | |
/// <remarks> | |
/// Because the SessionFactory creation is lazy-loaded, you technically never need to bootstrap NHibernate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IQueryable<T> FindBy(Expression<Func<T, bool>> predicate, params Expression<Func<T, object>>[] includes) | |
{ | |
var query = GetAll().Where(predicate); | |
return includes.Aggregate(query, (current, includeProperty) => current.Include(includeProperty)); | |
} | |
// Sample usage | |
userRepository.FindBy(x => x.Username == username, x.Roles) |
NewerOlder