Skip to content

Instantly share code, notes, and snippets.

View anderly's full-sized avatar

Adam Anderly anderly

View GitHub Profile
@anderly
anderly / Delete-Teams-Messages.js
Last active June 8, 2023 18:03 — forked from kiki67100/Delete-Teams-Messages.js
Delete batch messages Microsoft Teams
(function() {
var JQ = jQuery("iframe").contents();
var queue = [];
var last_processed = (new Date()).getTime();
var loading = true;
var my_name = null;
var mouse = function(which, element) {
var evt = element.ownerDocument.createEvent('MouseEvents');
@anderly
anderly / Startup.cs
Last active June 14, 2022 08:50
MediatR Pipeline Behavior Registration.
// Register MediatR Pipeline Behaviors
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(LoggingBehavior<,>));
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(CachingBehavior<,>));
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(FallbackBehavior<,>));
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(RetryBehavior<,>));
// ICachePolicy discovery and registration
services.Scan(scan => scan
.FromAssemblies(assembly)
@anderly
anderly / Details.cs
Last active December 12, 2019 19:52
MediatR Fallback Pipeline Behavior
public class Handler : IRequestHandler<Query, Customer>, IFallbackHandler<Query, Customer>
{
private readonly ICustomerRepository _db;
private readonly ICustomerRepository<SourceSystem.Secondary> _db2;
private readonly IConfigurationProvider _configuration;
public Handler(ICustomerRepository db, ICustomerRepository<SourceSystem.Secondary> db2, IConfigurationProvider configuration)
{
_db = db;
_db2 = db2;
@anderly
anderly / Details.cs
Last active December 12, 2019 19:48
MediatR Retry Pipeline Behavior
public class Handler : IRequestHandler<Query, Customer>, IRetryableRequest<Query, Customer>
{
private readonly CustomerContext _db;
private readonly IConfigurationProvider _configuration;
// By implementing IRetryableRequest<TRequest, TResponse> I get the following
// properties to control how my "Handle" method will get retried.
public int RetryAttempts => 2;
public int RetryDelay => 500;
public bool RetryWithExponentialBackoff => true;
@anderly
anderly / CacheService.cs
Last active July 24, 2024 10:02
MediatR Caching Pipeline Behavior
public class CacheService : ICache
{
private readonly string _keyPrefix;
private readonly IDistributedCache _cache;
private readonly IConfiguration _config;
public CacheService(IDistributedCache cache, IConfiguration config)
{
_cache = cache;
_config = config;
@anderly
anderly / FilterMenu.vue
Last active August 16, 2019 16:17
Make Laravel Nova Per Page options configurable both globally and at resource level.
<template>
<dropdown
v-if="filters.length > 0 || softDeletes || !viaResource"
dusk="filter-selector"
class-whitelist="flatpickr-calendar"
>
<dropdown-trigger
slot-scope="{ toggle }"
:handle-click="toggle"
class="bg-30 px-3 border-2 border-30 rounded"
@anderly
anderly / Index.vue
Created March 13, 2019 05:26
Make Index.vue support initializing viaResource, viaResourceId and viaRelationship from query string.
<template>
<loading-view :loading="initialLoading" :dusk="resourceName + '-index-component'">
<custom-index-header v-if="!viaResource" class="mb-3" :resource-name="resourceName" />
<div v-if="shouldShowCards">
<cards
v-if="smallCards.length > 0"
:cards="smallCards"
class="mb-3"
:resource-name="resourceName"
@anderly
anderly / showdown.md
Last active September 17, 2016 19:10
Ideas for making ShowDown extensible

Ideas for making ShowDown extensible:

I recently had to customize your plugin a bit for a client but wanted to suggest a few hooks and filters that could be added to the plugin to create some extensibility points for your customers.

Here are the hooks I added which would be great if you could add them into the main plugin so I could still get updates without having to do diffs when the plugin gets updated.

1st set of changes: Adding hooks to Anti-Cheat settings

File: wpshowdown.php
@anderly
anderly / woocommerce-add-custom-product-data-tab.php
Last active June 8, 2023 20:30
WooCommerce - Add Custom Product Data Tab
// First Register the Tab by hooking into the 'woocommerce_product_data_tabs' filter
add_filter( 'woocommerce_product_data_tabs', 'add_my_custom_product_data_tab' );
function add_my_custom_product_data_tab( $product_data_tabs ) {
$product_data_tabs['my-custom-tab'] = array(
'label' => __( 'My Custom Tab', 'my_text_domain' ),
'target' => 'my_custom_product_data',
);
return $product_data_tabs;
}
@anderly
anderly / DFP Interstitial Ad
Last active March 13, 2017 16:34
DFP Interstitial Ad Code
<script>
var DmagInterstitialAd = DmagInterstitialAd || {};
DmagInterstitialAd.showInterstitial = true;
DmagInterstitialAd.adWidth = 720;
DmagInterstitialAd.adHeight = 480;
DmagInterstitialAd.destinationURL = "http://ad.doubleclick.net/ddm/trackclk/N5716.759086CENTRO.NET/B8239828.110882020;dc_trk_aid=283955045;dc_trk_cid=59150503";
DmagInterstitialAd.embedCode = '<img src="http://ad.doubleclick.net/ddm/trackimp/N5716.759086CENTRO.NET/B8239828.110882020;dc_trk_aid=283955045;dc_trk_cid=59150503;ord=[timestamp]?" border="0" height="1" width="1" alt="Advertisement">';
/*-------------------------------------------------------------------------------------------------------*/
/* DO NOT MODIFY CODE BELOW */