Skip to content

Instantly share code, notes, and snippets.

View StephenFluin's full-sized avatar

Stephen Fluin StephenFluin

View GitHub Profile
@StephenFluin
StephenFluin / a.directive.ts
Last active September 29, 2023 00:03
A directive to automatically make all external `a` links noopener, noreferrer, and target _blank.
import { Directive, ElementRef } from '@angular/core';
@Directive({
selector: 'a',
standalone: true,
})
export class ADirective {
constructor(public ref: ElementRef) {}
ngAfterViewInit() {
@StephenFluin
StephenFluin / angular-install.sh
Created July 11, 2018 21:47
Install Angular on a *nix system
# NVM
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm install 10
# Yarn
curl -o- -L https://yarnpkg.com/install.sh | bash
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
@StephenFluin
StephenFluin / gmp-verified.sol
Created July 18, 2023 07:20
A quick example of writing an Axelar Executable that only accepts messages from a single source
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {AxelarExecutable} from "@axelar-network/axelar-gmp-sdk-solidity/contracts/executable/AxelarExecutable.sol";
import {IAxelarGateway} from "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGateway.sol";
import {IAxelarGasService} from "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGasService.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract SenderReceiver is AxelarExecutable, Ownable {
IAxelarGasService public immutable gasService;
@StephenFluin
StephenFluin / upload.component.ts
Created October 3, 2016 20:30
Firebase Uploader Component with Angular 2
import { Component, Input } from '@angular/core';
import { Router } from '@angular/router';
import { AngularFire, FirebaseListObservable } from 'angularfire2';
import { Observable } from 'rxjs';
declare var firebase: any;
interface Image {
path: string;
@StephenFluin
StephenFluin / app.js
Created October 9, 2015 14:47
Sample Trello node.js Webhook Server
/**
* This is a sample webhook server that listens for webhook
* callbacks coming from Trello, and updates any cards that are
* added or modified so everyone knows they are "PRIORITY"
*
* To get started
* * Add your key and token below
* * Install dependencies via `npm install express request body-parser`
* * Run `node app.js` on a publicly visible IP
* * Register your webhook and point to http://<ip or domain>:3123/priority
@StephenFluin
StephenFluin / equipment.md
Last active March 30, 2022 16:43
My equipment and setup
import { Directive, ElementRef } from '@angular/core';
@Directive({
selector: 'img'
})
export class LazyImagesDirective {
constructor(ref: ElementRef) {
ref.nativeElement.loading = 'lazy';
}
let lcp = await page.evaluate(() => new Promise((resolve, reject) => {
try {
// Create a variable to hold the latest LCP value (since it can change).
let lcp;
// Create the PerformanceObserver instance.
const po = new PerformanceObserver((entryList) => {
const entries = entryList.getEntries();
const lastEntry = entries[entries.length - 1];
@StephenFluin
StephenFluin / contributors.md
Last active May 28, 2019 19:32
8.0.0 Contributors

Adam Bradley, Adam Plumer, Adam Yi, Ahsan Ayaz, Alan, Alan Agius, Alberto Garza, Alex Eagle, Alexey Zuev,

import { Component, Output } from '@angular/core';
import { Subject } from 'rxjs';
@Compnent({
template: '<child-component (myCustomEvent)="myOtherEvent.next($event)"></child-component>',
})
export class EmitComponent {
@Output() myOtherEvent = new Subject<any>();
}