Skip to content

Instantly share code, notes, and snippets.

View randyburden's full-sized avatar

Randy Burden randyburden

View GitHub Profile
@mattjohnsonpint
mattjohnsonpint / LICENSE
Last active April 2, 2024 02:54
Unified global Unhandled Exception event for .NET MAUI
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:
@dalexsoto
dalexsoto / HttpClientProgressExtensions.cs
Last active April 3, 2024 15:01
Add Progress reporting to capabilities to HttpClient
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))
{
@jylopez
jylopez / stripe_country_codes.js
Last active December 24, 2023 23:27
Stripe Country Codes
[
{ 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' },
@theorigin
theorigin / SQLServer-APIPost.sql
Last active January 9, 2024 12:10
SQL Server code to POST to an API
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;
@bbrown
bbrown / NEWID.sql
Created February 10, 2016 16:33
Create GUID, remove dashes, and lower case in T-SQL
SELECT LOWER(REPLACE(NEWID(),'-',''))
@EdCharbeneau
EdCharbeneau / kendo-export.js
Created March 24, 2015 15:06
Export to image with Kendo UI
// 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,
@ramonsmits
ramonsmits / gist:7563502
Created November 20, 2013 13:52
Example of Mandrill webhook JSON data.
[
{
"event": "send",
"msg": {
"ts": 1365109999,
"subject": "This an example webhook message",
"email": "example.webhook@mandrillapp.com",
"sender": "example.sender@mandrillapp.com",
"tags": [
"webhook-example"
@randyburden
randyburden / NHibernateHelper.cs
Created November 28, 2012 21:02
NHibernate Helper Class
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
@oneillci
oneillci / gist:3205384
Created July 30, 2012 06:45
Using EF Include() with generic repository
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)
@marciomazza
marciomazza / highlight_sel_element.py
Created July 10, 2012 22:10
Highlights a Selenium Webdriver element
def highlight(element):
"""Highlights (blinks) a Webdriver element.
In pure javascript, as suggested by https://github.com/alp82.
"""
driver = element._parent
driver.execute_script("""
element = arguments[0];
original_style = element.getAttribute('style');
element.setAttribute('style', original_style + "; background: yellow; border: 2px solid red;");
setTimeout(function(){