Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Neuhauser eneuhauser

  • C2FO
  • Kansas City
View GitHub Profile
View README.md

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 Feb 17, 2020
C2FO Project Tab Completion
View README.md

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=(
View conn.decorator.spec.ts
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 Nov 21, 2017
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.
View kill_server.sh
#! /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 Mar 31, 2017
Output a table of array of arrays in the console.
View to-table.js
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 Mar 23, 2017
List Wikis for a GitHub Organization's Repositories
View list-wikis.js
/**
* 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 => {
View adapters.application.js
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 Jul 23, 2018
Keybase Identity
View keybase.md

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:

View routes.application.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
foo() {
alert("I'm the application route");
}
}
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
skillService: Ember.inject.service('skills'),
init: function() {
this._super.apply(this, arguments);