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 / 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 / equipment.md
Last active March 30, 2022 16:43
My equipment and setup
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];
import { Directive, ElementRef } from '@angular/core';
@Directive({
selector: 'img'
})
export class LazyImagesDirective {
constructor(ref: ElementRef) {
ref.nativeElement.loading = 'lazy';
}
@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>();
}
@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"
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
const ts = require("typescript");
const plugin_1 = require("./plugin");
const refactor_1 = require("./refactor");
const loaderUtils = require('loader-utils');
const NormalModule = require('webpack/lib/NormalModule');
// This is a map of changes which need to be made
const changeMap = {
<div>
From: {{from}}
<md-select [(ngModel)]="from">
<md-option value="200">2.0</md-option>
<md-option value="201">2.1</md-option>
<md-option value="202">2.2</md-option>
<md-option value="203">2.3</md-option>
<md-option value="204">2.4</md-option>
<md-option value="400">4.0</md-option>
<md-option value="500">5.0</md-option>