Skip to content

Instantly share code, notes, and snippets.

Kevin Upton kevupton

Block or report user

Report or block kevupton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kevupton
kevupton / fx-if.directive.ts
Last active Sep 1, 2019
Angular Flex Layout fxIf equivalent of ngIf
View fx-if.directive.ts
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 {
View scrollcontroller.ts
interface ScrollSectionConfig {
height : number;
speed : number;
}
interface Vector {
x : number;
y : number;
}
@kevupton
kevupton / convert-webp
Created Apr 5, 2019
WebP convert all images in current directory
View convert-webp
#!/bin/bash
for file in *
do
echo "Converting: '$file'"
cwebp -q 80 "$file" -o "webp/$file.webp" > /dev/null 2>&1
done
echo "Complete!"
@kevupton
kevupton / xxx.sh
Last active Feb 18, 2019
Git Commiter with ID
View xxx.sh
#!/bin/bash
{
# BRANCH="feature/AGS-62-agtrader-digital-ad-changes-for-d"
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>&1)
} || {
echo "Is not a git repository..."
exit 1;
}
@kevupton
kevupton / xc.sh
Last active Feb 18, 2019
Checkouter
View xc.sh
#!/bin/bash
command=$(basename $0)
usage() { printf "Usage: ${BLUE}$command${NC} ${RED}[search-term]${NC} ${GREEN}[-f]${NC}\n" 1>&2; exit 1; }
CODE=$1
TMP=~/.xc
TIME_CHANGE=3600
RED='\033[0;33m'
@kevupton
kevupton / user-data.sh
Last active Nov 13, 2018
User Data for initializing an EC2 using Ubuntu with Docker GPU
View user-data.sh
#!/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 Mar 21, 2018
Fix for AWS puppeteer linux instance
View aws_puppeteer_fix.sh
#!/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
View php-storm.xml
<code_scheme name="Main" version="173">
<PHPCodeStyleSettings>
<option name="ALIGN_KEY_VALUE_PAIRS" value="true" />
<option name="ALIGN_PHPDOC_PARAM_NAMES" value="true" />
<option name="ALIGN_PHPDOC_COMMENTS" value="true" />
<option name="ALIGN_ASSIGNMENTS" value="true" />
<option name="COMMA_AFTER_LAST_ARRAY_ELEMENT" value="true" />
<option name="PHPDOC_BLANK_LINE_BEFORE_TAGS" value="true" />
<option name="PHPDOC_WRAP_LONG_LINES" value="true" />
<option name="ELSE_IF_STYLE" value="COMBINE" />
View index.d.ts
declare namespace store {
const local : StoreAPI;
const session : StoreAPI;
function area (id : string, area : Storage) : StoreAPI;
function set (key : any, data : any, overwrite? : boolean) : any;
function setAll (data : Object, overwrite? : boolean) : StoredData;
function get (key : any, alt? : any) : any;
function getAll () : StoredData;
function transact (key : any, fn : (data : any) => any, alt? : any) : StoreAPI;
You can’t perform that action at this time.