Skip to content

Instantly share code, notes, and snippets.

View tommydunn's full-sized avatar
🖖

Tommy Dunn tommydunn

🖖
View GitHub Profile
@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 / set-git-to-use-ssh.sh
Created August 26, 2025 19:02
Set git to use git:// instead of https://
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
@tommydunn
tommydunn / index.html
Last active December 23, 2024 06:06
Slick Slider with auto play YouTube, Vimeo and HTML5 video
<header>
<h1>SITE TITLE</h1>
<nav>
<ul>
<li><a href="#">HOME</a></li>
<li><a href="#">ABOUT</a></li>
<li><a href="#">SERVICES</a></li>
<li><a href="#">CONTACT</a></li>
</ul>
</nav>
@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 / _A-interpolation.scss
Last active March 14, 2024 00:05
Sass Mixin's for Fluid Type
@mixin interpolate($properties, $min-screen, $max-screen, $min-value, $max-value) {
& {
@each $property in $properties {
#{$property}: $min-value;
}
@media screen and (min-width: $min-screen) {
@each $property in $properties {
#{$property}: calc-interpolation($min-screen, $min-value, $max-screen, $max-value);
}
@tommydunn
tommydunn / rake_cheat_sheet.md
Last active September 11, 2023 12:22
Rake Cheat Sheet

DATABASE

Setup test env db

  • RAILS_ENV=test rake db:create
  • RAILS_ENV=test rake db:migrate
  • RAILS_ENV=test rake db:reset

Roll db migration back by one

  • rake db:rollback

Roll db migration back n number

@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 / zmv-examples.md
Last active February 21, 2022 08:08 — forked from niksmac/zmv-examples.md
ZMV-Examples (require autoload zmv)
# rename a section of a filename, i. e. example.1.{txt,conf,db} or 12345.1.{wav,ogg,mp3} and
# change the 1 to a 2 in the filename while preserving the rest of it.
  $ zmv -n '(*.)(<->)(.[^.]#)' '$1$(($2+1))$3' # would rename x.0001.y to x.2.y.
  $ zmv -n '(*.0#)(<->)(.[^.]#)' '$1$(($2+1))$3'

# Rename files to lower case
  $ zmv '*' '${(L)f}'

# serially all files (foo.foo > 1.foo, fnord.foo > 2.foo, ..)