Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Programmin'

Evan Tahler evantahler

💭
Programmin'
View GitHub Profile
@evantahler
evantahler / example.ts
Created Aug 28, 2021
Inheriting class method augment types in Typescript
View example.ts
abstract class Greeter {
abstract greet(who: string, message: string): void;
}
class ClassyGreeter extends Greeter {
greet(who, message) {
console.log(`Salutations, ${who}. ${message}`);
}
}
@evantahler
evantahler / purchases.csv
Last active Aug 4, 2021
Grouparoo Sample Data CSVs
View purchases.csv
id user_id item category price state created_at
1 69 88 Garden 68.13 successful 2021-06-07 00:43:22.505
2 155 25 Grocery 75.89 successful 2021-06-07 04:29:33.122
3 560 59 Books 19.7 successful 2021-07-31 07:40:07.724
4 562 95 Games 17.64 successful 2021-07-10 10:49:36.804
5 64 24 Kids 76.08 successful 2021-07-28 18:38:26.248
6 402 88 Movies 42.87 successful 2021-07-20 04:59:39.054
7 319 67 Garden 22.85 successful 2021-07-22 18:17:16.081
8 86 69 Outdoors 25.21 successful 2021-06-19 04:55:45.292
9 585 51 Grocery 34.85 successful 2021-07-08 07:35:33.024
@evantahler
evantahler / gifit
Last active Jun 26, 2020
Convert movies to animated gifs
View gifit
#!/bin/bash
# This script required ffmpeg and gifsicle
# On OSX: `brew install ffmpeg gifsicle`
SECONDS=0
INPUT_FILE=$1
BASENAME="${INPUT_FILE%.*}"
OUTPUT_FILE="$BASENAME.gif"
@evantahler
evantahler / server.ts
Last active Feb 9, 2020
Actionhero#future
View server.ts
// There is no more actionhero CLI (start, startCluster, etc). You make your own 'main' file.
// This should make running in Docker, Serverless, etc easier.
// This also removes `boot.js`
import { Process, config, log } from '@actionhero/core' // we use NPM namespaces
// The core Actionhero package is really small... and you can opt-in to the parts you want
import WebServer from '@actionhero/web'
import WebSocketServer from '@actionhero/websocket'
import Cache from '@actionhero/cache'
import Resque from '@actionhero/resque'
@evantahler
evantahler / comcast.js
Last active Sep 21, 2019
Comcast Injected Javasctipt
View comcast.js
<script language="JavaScript" type="text/javascript">
// Copyright (C) 2017 Comcast Cable Communications, LLC
// Contact Us: http://customer.xfinity.com/contact-us/
// Intended use of this message is to display critical and time sensitive notifications to customers.
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
@evantahler
evantahler / setup.sh
Last active Sep 3, 2019
Setting up a new computer via sshcode
View setup.sh
#!/bin/bash
# First, configure the host to run VSCode with SSHCODE - https://github.com/cdr/sshcode
# Then, run this command via the command line exposed from the new VSCode window (assuming as Root)
# Inspired by https://github.com/evantahler/workstation
###
# Run Command:
# wget https://gist.githubusercontent.com/evantahler/ddfbe3101c3c9fe8451c6412e288c9fa/raw/85e544e513591f316ec23a482419e6e060431fac/setup.sh && chmod 0766 setup.sh && ./setup.sh
###
@evantahler
evantahler / vpn-reconnect.scpt
Created Aug 9, 2019
Keep that VPN Connected (OSX)
View vpn-reconnect.scpt
on idle
tell application "System Events"
tell current location of network preferences
set VPNService to the service "vpn-evan" -- replace this with the name of your VPN connection
if VPNService is not null then
if current configuration of VPNService is not connected then
beep
beep
beep
connect VPNService
View require-shim.js
// in your action
{formatter} = requrie('../helper.js')
// in helper.js
const path = require('path')
exports.formatter = require(path.join(__dirname, 'path', 'that', 'is', 'really', 'long', 'formatter.js'))
@evantahler
evantahler / test.js
Created Mar 28, 2018
Testing Node.JS browser apps with Selenium, Async/Await, and Jest
View test.js
/**
* @jest-environment jest-environment-webdriver
*/
const url = 'https://www.actionherojs.com'
describe('www.actionherojs.com#index', () => {
test('it renders', async () => {
await browser.get(url)
const title = await browser.findElement(by.tagName('h2')).getText()