Skip to content

Instantly share code, notes, and snippets.

View tommydunn's full-sized avatar
🖖

Tommy Dunn tommydunn

🖖
View GitHub Profile
@tommydunn
tommydunn / set-git-to-use-ssh.sh
Created August 26, 2025 19:02
Set git to use git:// instead of https://
git config --global url."[email protected]:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
@tommydunn
tommydunn / ngx-html-video.md
Created July 9, 2025 08:37
To check if an HTML5 video element is "ready" in an Angular 18 application, you can leverage the events and properties of the native HTMLMediaElement.

is "ready"

To check if an HTML5 video element is "ready" in an Angular 18 application, you can leverage the events and properties of the native HTMLMediaElement.

1. Using canplaythrough event:

The canplaythrough event fires when the user agent estimates that it can play the media to the end without stopping for further buffering. This is typically the most reliable indicator that the video is truly ready for smooth playback. TypeScript

import { Component, ViewChild, ElementRef, AfterViewInit } from '@angular/core';
@tommydunn
tommydunn / outlook_gif_fallback_example.html
Created December 20, 2024 17:53
Example showing how to add a static image fallback for outlook 2007-2019
<!-- GIF Image for everywhere else -->
<!--[if (gte mso 9)|(IE)]><!-->
<img src="https://cdn.zmbz.com/lpl_gif_example.gif"
style="display: block; padding:0; margin:0; height: auto; max-width: 100%;" border="0"
alt="" width="538" height="269" />
<!--<![endif]-->
<!--Fallback Static Image for Outlook-->
@tommydunn
tommydunn / slugify.pipe.ts
Created April 12, 2023 21:05 — forked from djabif/slugify.pipe.ts
Angular Pipe to transform a string into a slug
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'slugify'})
export class SlugifyPipe implements PipeTransform {
transform(input: string): string {
return input.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
∇ app
∇ core
∇ guards
auth.guard.ts
module-import.guard.ts
no-auth.guard.ts
∇ interceptor
token.interceptor.ts
error.interceptor.ts
∇ services
@tommydunn
tommydunn / semantic-commit-messages.md
Created November 15, 2022 10:54 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@tommydunn
tommydunn / mysql_cheat_sheet.md
Created September 22, 2021 15:29 — forked from bradtraversy/mysql_cheat_sheet.md
MySQL Cheat Sheet

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@tommydunn
tommydunn / SETUP.md
Created September 22, 2021 15:28 — forked from jagdeepsingh/SETUP.md
Set up macOS Big Sur 11.2 with development tools | Git | Homebrew | rbenv | ruby | Atom | PostgreSQL | mongodb
@tommydunn
tommydunn / change.js
Created September 22, 2021 03:10 — forked from DmitriyRF/change.js
Remove or don't redirect “thank you” page Mailchimp
/* To use this example:
1. Download this html file
2. Replace the form action url with your own from the MailChimp supplied embed code
3. Within the action url, replace "subscribe/post" with "subscribe/post-json"
4. Be sure the action url starts with http://. If it doesn't, the form will hang when testing the html as a local file in your browser.
5. Open this file in a browser on your local machine
*/

Generate guard

ng g guard guards/auth
  -> select "canActivate"

auth.guard.ts

import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router';