Skip to content

Instantly share code, notes, and snippets.

interface ScrollSectionConfig {
height : number;
speed : number;
}
interface Vector {
x : number;
y : number;
}
@kevupton
kevupton / fx-if.directive.ts
Last active September 1, 2019 03:52
Angular Flex Layout fxIf equivalent of ngIf
import { isPlatformBrowser } from '@angular/common';
import { Directive, ElementRef, Inject, Input, OnDestroy, OnInit, PLATFORM_ID } from '@angular/core';
import { MediaObserver } from '@angular/flex-layout';
import { BehaviorSubject, combineLatest, Subscription } from 'rxjs';
@Directive({
selector: '[fxIf],' + ['xs', 'md', 'lg', 'xl', 'lt-sm', 'lt-md', 'lt-lg',
'lt-xl', 'gt-xs', 'gt-sm', 'gt-md', 'gt-lg'].map(key => `[fxIf.${key}]`).join(','),
})
export class FxIfDirective implements OnInit, OnDestroy {
<template>
<div class="hello">Hello {{who}} World</div>
</template>
<script>
module.exports = {
props: {
who: String,
},
};
@kevupton
kevupton / contracts...2022-04-07_AirGrabbable.sol
Created April 7, 2022 02:38
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract PooNami is ERC20 {
constructor() ERC20('PooNami', 'POO') {
_mint(msg.sender, 1e24);
}
}
interface IMintable {
@kevupton
kevupton / contracts...2022-04-07_AirGrabbable.sol
Created April 7, 2022 02:40
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract PooNami is ERC20 {
constructor() ERC20('PooNami', 'POO') {
_mint(msg.sender, 1e24);
}
}
contract AirGrap {
@kevupton
kevupton / user-data.sh
Last active April 11, 2022 19:02
User Data for initializing an EC2 using Ubuntu with Docker GPU
#!/bin/bash
sudo apt-get remove docker docker-engine docker.io
sudo apt-get update -qq
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@kevupton
kevupton / aws_puppeteer_fix.sh
Created March 21, 2018 11:01
Fix for AWS puppeteer linux instance
#!/bin/bash
# Fixes the puppeteer not being able to spawn an instance on their AWS linux instance.
# Install ATK from CentOS 7
sudo yum install cups-libs dbus-glib libXrandr libXcursor libXinerama cairo cairo-gobject pango
sudo rpm -ivh --nodeps http://mirror.centos.org/centos/7/os/x86_64/Packages/atk-2.22.0-3.el7.x86_64.rpm
sudo rpm -ivh --nodeps http://mirror.centos.org/centos/7/os/x86_64/Packages/at-spi2-atk-2.22.0-2.el7.x86_64.rpm
sudo rpm -ivh --nodeps http://mirror.centos.org/centos/7/os/x86_64/Packages/at-spi2-core-2.22.0-1.el7.x86_64.rpm
#!/bin/bash
export NODE_OPTIONS="--max-old-space-size=1028"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/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 16