Skip to content

Instantly share code, notes, and snippets.

View bcanzanella's full-sized avatar
:octocat:

Brian Canzanella bcanzanella

:octocat:
View GitHub Profile
@tushargupta51
tushargupta51 / app.js
Last active February 24, 2021 04:25
App reloading inside iFrame when renewing token - Solution 2
'use strict';
angular.module('todoApp', ['ngRoute','AdalAngular'])
.config(['$routeProvider', '$httpProvider', 'adalAuthenticationServiceProvider', function ($routeProvider, $httpProvider, adalProvider) {
$routeProvider.when("/Home", {
controller: "homeCtrl",
templateUrl: "/App/Views/Home.html",
}).when("/TodoList", {
controller: "todoListCtrl",
templateUrl: "/App/Views/TodoList.html",
@Kukks
Kukks / unit-of-work-observer.ts
Last active February 14, 2020 09:03
Aurelia Unit Of Work Observer
import { CloneUtility } from "./clone";
import { Disposable } from "aurelia-binding";
import { BindingEngine } from "aurelia-binding";
/**
* Unit Of Work Observer
* Based on the work of fragsalat's MultiObserver found at
* https://gist.github.com/fragsalat/819a58021fc7b76a2704
*
*
* The purpose of this observer is to observe all changes made to a model and allows you
@jdanyow
jdanyow / app.html
Last active April 25, 2017 02:15
Aurelia - JQueryUI DatePicker
<template>
<require from="./datepicker"></require>
Pick a date:
<input datepicker value.bind="dateValue">
<p>${dateValue}</p>
</template>
@jamesramsay
jamesramsay / README.md
Last active August 14, 2025 17:11
Gmail: delete old emails automatically

Gmail: delete old emails automatically

Automatically deletes old emails that match the specified label.

Get started

  • Create a new Google Apps Script at https://script.google.com
  • Overwrite the placeholder with the javascript below
  • Update the following constants:
  • LABEL_TO_DELETE: the label that should be have old messages deleted
@davemackintosh
davemackintosh / map-to-json.js
Last active August 7, 2023 15:49
Convert ES6 `Map`s to a standard JSON object without effing Babel.
/**
* Convert a `Map` to a standard
* JS object recursively.
*
* @param {Map} map to convert.
* @returns {Object} converted object.
*/
function map_to_object(map) {
const out = Object.create(null)
map.forEach((value, key) => {
@fragsalat
fragsalat / MultiObserver.js
Last active January 27, 2017 13:45
Aurelia multi observer class to observe multiple properties on one object or multiple properties on multiple objects. See usage of observe function
import {ObserverLocator, inject} from 'aurelia-framework';
/**
* Helper class to observe multiple properties at once
*/
@inject(ObserverLocator)
export class MultiObserver {
/**
* Get injected observer
@madskristensen
madskristensen / ImportMefComponent.cs
Last active November 7, 2024 13:10
Import MEF components from non-MEF exported classes
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.TableManager;
public class ExtensionPackage : Package
{
[Import]
private ITableManagerProvider _tableManagerProvider;
protected override void Initialize()
@svantreeck
svantreeck / JsonWebToken.cs
Created April 16, 2015 13:41
ServiceStack JWT Token validation for Auth0
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using ServiceStack.Text;
namespace ServiceStackAPI
{
public static class JsonWebToken
@maartenba
maartenba / DomainTemplateRoute - GetVirtualPath
Last active May 15, 2023 07:30
ASP.NET MVC 6 / ASP.NET 5 Domain Routing + Tenant Middleware
public string GetVirtualPath(VirtualPathContext context)
{
foreach (var matcherParameter in _matcher.Template.Parameters)
{
context.Values.Remove(matcherParameter.Name); // make sure none of the domain-placeholders are appended as query string parameters
}
return _innerRoute.GetVirtualPath(context);
}
@afreeland
afreeland / gist:6733381
Last active June 13, 2025 19:00
C#: LINQ Expression Builder dynamic where clause based on filters
public class ExpressionBuilder
{
// Define some of our default filtering options
private static MethodInfo containsMethod = typeof(string).GetMethod("Contains", new[] { typeof(string) });
private static MethodInfo startsWithMethod = typeof(string).GetMethod("StartsWith", new[] { typeof(string) });
private static MethodInfo endsWithMethod = typeof(string).GetMethod("EndsWith", new[] { typeof(string) });
public static Expression<Func<T, bool>> GetExpression<T>(List<GridHelper.Filter> filters)
{
// No filters passed in #KickIT