Skip to content

Instantly share code, notes, and snippets.

View Zyzle's full-sized avatar
🏴󠁧󠁢󠁳󠁣󠁴󠁿

Colin McCulloch Zyzle

🏴󠁧󠁢󠁳󠁣󠁴󠁿
View GitHub Profile

Keybase proof

I hereby claim:

  • I am zyzle on github.
  • I am zyzle (https://keybase.io/zyzle) on keybase.
  • I have a public key ASBa9wRb_nXrdQPBF1ZwpkRNl5DYFD3QIEI2TGNactgqiQo

To claim this, I am signing this object:

@Zyzle
Zyzle / index.js
Last active September 23, 2022 20:40
Correcting image-colours to work with browsers that don't support 2d context in OffscreenCanvas
// Around line 127
createImageBitmap(file).then((ibm) => {
let ctx;
if (typeof OffscreenCanvasRenderingContext === "function"){
const canvas = new OffscreenCanvas(ibm.width, ibm.height);
ctx = canvas.getContext("2d");
}
else {
const canvas = document.createElement("canvas");
@Zyzle
Zyzle / luxon-date-adapter.spec.ts
Last active November 12, 2020 14:11
Luxon date adaptor for angular material
import { LOCALE_ID } from '@angular/core';
import { async, inject, TestBed } from '@angular/core/testing';
import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';
import { DateTime, Settings } from 'luxon';
import { LuxonDateAdapter, LUXON_DATE_FORMATS } from './luxon-date-adapter';
// avoid confusion when working with months
@Zyzle
Zyzle / auth.guard.ts
Created July 21, 2016 10:32
Angular 2 Firebase auth guard
import { Injectable } from '@angular/core';
import { CanActivate, Router } from '@angular/router';
import { FirebaseAuth, FirebaseAuthState } from 'angularfire2';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class AuthGuard implements CanActivate {
constructor(private auth: FirebaseAuth, private router: Router) { }
@Zyzle
Zyzle / app.ts
Created July 17, 2015 07:58
Simple routing example
import {NgFor, Component, View, bootstrap, bind, Injectable} from 'angular2/angular2';
import {Router, RouteConfig, RouterLink, RouterOutlet, routerInjectables} from 'angular2/router';
@Component({
selector: 'other-pageb'
})
@View({
template: `<p>yet another page </p>`
})
class OtherPageB {