Skip to content

Instantly share code, notes, and snippets.

View rippo's full-sized avatar

Richard Wilde rippo

View GitHub Profile
@rippo
rippo / Plugins.cs
Last active December 13, 2024 13:19
using System.ComponentModel;
using Microsoft.SemanticKernel;
public sealed class TimePlugin
{
[KernelFunction]
[Description("Retrieves the current time in UTC")]
public string GetCurrentUtcTime() => DateTime.UtcNow.ToString("R");
}
@rippo
rippo / IMediator.cs
Last active November 14, 2024 15:46
Mediator Pattern using simple Injector
public interface IMediator
{
TResponse Request<TResponse>(IQuery<TResponse> query);
Task<TResponse> RequestAsync<TResponse>(IQuery<TResponse> query);
void Send(ICommand command);
Task SendAsync(ICommand command);
@rippo
rippo / gist:c6cde230b6aee0e1830bc0efba6005e6
Created February 16, 2024 16:07
client side checkout.js for paypal
async function createOrderCallback() {
try {
const response = await fetch("/payV2/checkout", {
method: "POST",
headers: {
"Content-Type": "application/json",
}
});
const orderData = await response.json();
@rippo
rippo / gist:f39dfe259bad3ae27b89032b5cbbc17c
Created February 13, 2024 08:48
Enable ssl on a .net 4.5 site
FROM Stack Overflow
https://stackoverflow.com/a/54697319/15410
I see this EXACT problem from time to time, when using SSL, and have found that (especially when working on someone else's project in a team environment) the Visual Studio project web settings (SSL ports) sometimes get messed up. Here's what I do to fix them:
In Solution Explorer, click your project.
@rippo
rippo / GitVersionIncrement.ps1
Last active August 9, 2021 15:31 — forked from nbarnwell/GitVersionIncrement.ps1
Simple PowerShell script to create the appropriate next tag on a git repo
function New-Tag {
[CmdletBinding(SupportsShouldProcess=$true)]
param(
[Parameter(Mandatory=$true)]
[string] $Tag)
process {
if ($PSCmdlet.ShouldProcess("git tag $Tag")) {
Write-Verbose "git tag $Tag"
git tag $Tag
}
private static Task<string> foo = null;
private static async Task<string> GetFooDataAsync()
{
async Task<string> GetFooDataInternal()
{
var response = await myHttpClient.GetFooAsync();
return response.data;
}
const puppeteer = require('puppeteer');
/**
* This is a thin wrapper so that we use a singleton of
* the browser that puppeteer creates
*/
class Browser {
setUp(done) {
const puppeteerOpts = this.options && this.options.puppeteer ?
this.options.puppeteer :
@rippo
rippo / Connection.cs
Created January 22, 2018 15:22 — forked from lancscoder/Connection.cs
Dapper Getting Started
public class ConnectionFactory {
public static DbConnection GetOpenConnection() {
var connection = new SqlConnection("MyConnectionString");
connection.Open();
return connection;
}
}
@rippo
rippo / account.login.page.js
Last active October 19, 2017 09:32
Page object pattern using chromeless
var AccountLoginPage = function (chromeless, options) {
this.chromeless = chromeless
this.options = options
this.usernameLocator = 'input[id="Username"]'
this.passwordLocator = 'input[id="Password"]'
this.submitButtonLocator = 'form input[type="submit"]'
this.inputWithValidationErrorLocator = 'input.input-validation-error'
this.usernameRequiredValidationLocator = '.field-validation-error[data-valmsg-for="Username"]'
[HtmlTargetElement("div")]
public class VisibilityTagHelper : TagHelper
{
public bool IsVisible { get; set; } = true;
public override void Process(TagHelperContext context, TagHelperOutput output)
{
if (!IsVisible)
output.SuppressOutput();