Skip to content

Instantly share code, notes, and snippets.

View eneuhauser's full-sized avatar

Eric Neuhauser eneuhauser

  • C2FO
  • Kansas City
View GitHub Profile
@eneuhauser
eneuhauser / _README.md
Last active October 14, 2024 14:26
Stravduro

Stravduro

Turn your group activity into an enduro event by selecting which segments to award points to the top finishers to see the total points across those segments. Enjoy the camaraderie of sticking together for most of the event with incentives to push harder for certain segments to be the overall winner. If you're hosting an event, list which segments are worth points ahead of time for athletes to star the segments to show up on their watch / phone / computer.

This currently gives points to the top ten finishers for a segment for the current day. First place gets ten point, second gets nine, etc. Athletes' points will be added up for all the segments to display the rankings of everyone that had a top ten finish for any of the segments.

Installing

  1. Copy the contents of bookmarklet.js to your clipboard
  2. Create a new bookmark and paste the contents as the URL

Using

@eneuhauser
eneuhauser / README.md
Last active June 4, 2020 15:07
Notable CLI

Installation

  1. Put these in a $DOTFILES/zsh/functions folder
  2. Make sure completions is loaded in your ZSH
  3. Add functions path to the fpath in ~/.zshenv
  4. Autoload the functions in your ~/.zshrc
# ~/.zshenv
fpath=(
@eneuhauser
eneuhauser / README.md
Last active February 17, 2020 17:00
C2FO Project Tab Completion

Installation

  1. Put these in a $DOTFILES/zsh/functions folder
  2. Make sure completions is loaded in your ZSH
  3. Add functions path to the fpath in ~/.zshenv
  4. Autoload the functions in your ~/.zshrc
# ~/.zshenv
fpath=(
@eneuhauser
eneuhauser / conn.decorator.spec.ts
Created October 31, 2019 01:15
Connection URL
import 'reflect-metadata';
import { Type } from '@nestjs/common';
import { plainToClass } from 'class-transformer';
import { Conn } from './conn.decorator';
import { ConnectionDetails } from './connection-details.interface';
jest.mock('./connection.service', () => ({
addConnectionDetails: () => {},
}));
@eneuhauser
eneuhauser / kill_server.sh
Created November 21, 2017 18:16
Script to kill applications listening to a port(s). Requires at least 2 parameters, the application and port, but could take in additional ports if more than one needs to be killed.
#! /bin/bash
PROC=$1
if [[ "$#" -lt 2 ]]; then
echo "Requires at least 2 arguments, the process name and at least one port number."
exit 1
fi
for ip in "$@"
@eneuhauser
eneuhauser / to-table.js
Last active March 31, 2017 20:06
Output a table of array of arrays in the console.
function toTable(data, headings=[], cellspacing=2, cellpadding=1) {
const widths = data.concat([headings]).reduce((widths, r) => r.reduce((ws, c, i) => {
let cur = ws[i] || 0, w = String(c).length;
ws[i] = w > cur ? w : cur;
return ws;
}, widths), []).map(w => w + cellpadding * 2), cs = center('|', cellspacing + 1);
if(headings.length) {
console.log(headings.map((h, i) => pad(center(h, widths[i]))).join(cs));
console.log(widths.map(w => '-'.repeat(w+cellpadding*2)).join(cs));
@eneuhauser
eneuhauser / list-wikis.js
Last active March 23, 2017 20:54
List Wikis for a GitHub Organization's Repositories
/**
* Executing the following in Chrome's console while viewing an organization's
* repositories will list available wiki pages for the those repostories. If
* paginated, you will have to repeat for each page.
*/
function listWikis() {
return Promise.all($('li.source h3 a').map(src => {
const home = src.href + '/wiki';
return new Promise(function(resolve) {
fetch(home, { credentials: 'include' }).then(r => r.text().then(t => {
import { Adapter } from 'ember-pouch';
import PouchDB from 'pouchdb';
export default Adapter.extend({
coalesceFindRequests: true,
init() {
this._super(...arguments);
@eneuhauser
eneuhauser / keybase.md
Last active July 23, 2018 20:37
Keybase Identity

Keybase proof

I hereby claim:

  • I am eneuhauser on github.
  • I am eneuhauser (https://keybase.io/eneuhauser) on keybase.
  • I have a public key ASDy9ZIQBnHo8XtlL1jP0nTJ1yiJxA3St3LWEako4qzxiwo

To claim this, I am signing this object:

@eneuhauser
eneuhauser / routes.application.js
Last active May 10, 2016 23:09
Bubble Example
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
foo() {
alert("I'm the application route");
}
}