Skip to content

Instantly share code, notes, and snippets.

View mattbrailsford's full-sized avatar

Matt Brailsford mattbrailsford

View GitHub Profile
<umb-control-group label="Label" description="Description">
{{value}}
</umb-control-group>
return new PaymentFormResult()
{
Form = new PaymentForm(cancelUrl, FormMethod.Get)
.WithAttribute("onsubmit", "return handlePaylikeCheckout(event)")
.WithJsFile("//sdk.paylike.io/3.js")
.WithJs(@"
var paylike = Paylike('" + publicKey + @"');
window.handlePaylikeCheckout = function (e) {
e.preventDefault();
paylike.popup({
- powershell: | # generates a hash of all packages.config and saves each on a single line on 'packages.hash.txt'
Get-FileHash -Algorithm MD5 -Path (Get-ChildItem packages.config -Recurse) >> packages.hash.txt
Write-Host "Hash File saved to packages.hash.txt"
displayName: 'Calculate and save packages.config hash'
- task: Cache@2
inputs:
key: 'nuget | "$(Agent.OS)" | packages.hash.txt'
restoreKeys: |
nuget | "$(Agent.OS)"
@mattbrailsford
mattbrailsford / Composer.cs
Last active February 19, 2020 13:46
Vendr Notification Handling
using Umbraco.Core.Composing;
using Vendr.Core.Events.Notification;
namespace MyNamespace
{
public class MyComposer : IUserComposer
{
public void Compose(Composition composition)
{
composition.WithNotificationEvent<OrderFinalizedNotification>()
(function () {
'use strict';
function MyController($scope, vendrMyResource, vendrRouteCache)
{
vendrRouteCache.getOrFetch("currentThing", () => vendrMyResource.getMyThing()).then(function (thing) {
// TODO: Handle my thing
console.log(thing);
});
angular.module('umbraco').factory('MyPropEditorClipboardActionHandler', function clipboardFactory() {
return {
handle: function () {
// Do something
}
}
});
public class MyController : SurfaceController, IRenderController
{
// Hijack route for doc type MyPage
[HijackRoute("MyPage")]
public ActionResult MyPage(ContentModel model)
{
// Do some stuff here, then return the base method
return base.Index(model);
}
@mattbrailsford
mattbrailsford / function.json
Last active October 29, 2021 08:12
Azure SignalR Service AutoScale Powershell Azure Function
{
"bindings": [
{
"name": "Timer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */5 * * * *"
}
]
}
@mattbrailsford
mattbrailsford / 1_ServiceInterfaces.cs
Last active May 18, 2019 15:00
Possible API Gateway Implementation
public interface IOrderService {
IEnumerable<IOrder> GetOrders(Guid storeId);
IOrder GetOrder(Guid storeId, Guid id);
IOrder CreateOrder(Guid storeId);
void SaveOrder(IOrder order);
void DeleteOrder(IOrder order);
}
public interface ICurrencyService {
IEnumerable<ICurrency> GetCurrencies(Guid storeId);
// All service have access to an ISessionManager that persists
// the current ids for the session (ISessionManager interface
// defined in core, with implementation in web project to
// store values in session / cookies OOTB)
OrderService.Get/SetCurrentOrder();
CurrencyService.Get/SetCurrentCurrency();
CountryService.Get/SetCurrentPaymentCountry();
CountryService.Get/SetCurrentPaymentRegion();
CountryService.Get/SetCurrentShippingCountry();