Skip to content

Instantly share code, notes, and snippets.

View kahunacohen's full-sized avatar

Aaron Cohen kahunacohen

View GitHub Profile
@kahunacohen
kahunacohen / pooleapp-comments.rb
Last active August 29, 2015 14:12
Gets comments from a pooleapp (http://www.pooleapp.com) form, writing the results to a YAML file. Reorganizes data structure indexing by the path the comment was submitted from.
#!/usr/bin/env ruby
# Gets comments from a pooleapp (http://www.pooleapp.com) form and writes
# the results to a YAML file indexed by the path the comment was submitted from.
# This allows you to more easily associate a comment with the page it was submitted
# from.
#
# Given a pooleapp form created on pooleapp.com with an API KEY of "MY_API_KEY" and the following
# form in a Jekyll template:
#
@kahunacohen
kahunacohen / .vimrc
Created March 13, 2015 13:27
My vim config file
" File: _vimrc
" Version: 1
" Author: Seth Mason
" Created: 19 Nov 2003 10:20:19
" Last-modified: 12 Mar 2015 16:38:42
" All my Vim commands for the taking
" Works on cygwin but not very well on unix machines...still trying to figure
" it out
@kahunacohen
kahunacohen / stringify-el.js
Created October 11, 2018 08:20
A function that stringifies a DOM element. Option to truncate the string representation if it's too big
/**
* Stringifies a DOM node.
* @param {Object} el - A DOM node.
* @param {Number} truncate - How much to truncate innerHTML of element.
* @returns {String} - A stringified node with attributes
* retained.
*/
function stringifyEl(el, truncate) {
var truncateLen = truncate || 50;
var outerHTML = el.outerHTML;
@kahunacohen
kahunacohen / ncbi-config.js
Created October 29, 2018 09:18
Custom Google Lighthouse config file for NCBI written audits
"use strict";
module.exports = {
// 1. Run your custom tests along with all the default Lighthouse tests.
extends: "lighthouse:default",
// 2. Add gatherer to the default Lighthouse load ('pass') of the page.
passes: [
{
passName: "defaultPass",
@kahunacohen
kahunacohen / links-in-buttons-audit.js
Created October 29, 2018 09:20
Custom NCBI written audit checking whether links are defined in button elements
@kahunacohen
kahunacohen / ncbi_app-audit.js
Created October 29, 2018 09:22
NCBI-written audit to test for meta with name="ncbi_app"
"use strict";
const Audit = require("lighthouse").Audit;
class NCBIAppAudit extends Audit {
static get meta() {
return {
id: "ncbi_app-audit",
title: 'meta name="ncbi_app" is set',
@kahunacohen
kahunacohen / ncbi_app-gatherer.js
Created October 29, 2018 09:23
NCBI-written gatherer for ncbi_app meta
"use strict";
const Gatherer = require("lighthouse").Gatherer;
/**
* @fileoverview Extracts `window.myLoadMetrics` from the test page.
*/
class NCBIAppMeta extends Gatherer {
async afterPass(options) {
@kahunacohen
kahunacohen / settings.json
Last active July 4, 2019 05:38
Visual Studio Code Settings
{
"window.zoomLevel": 2,
"git.autofetch": true,
"breadcrumbs.enabled": true,
"editor.minimap.maxColumn": 90,
"files.autoSave": "afterDelay",
"editor.tabSize": 2,
"javascript.updateImportsOnFileMove.enabled": "never",
"javascript.suggest.autoImports": false,
"files.trimFinalNewlines": true,
source ~/bash-utils/bu.sh
# General unix
export BASH_SILENCE_DEPRECATION_WARNING=1
# Remove safe, sends to trash.
# Removes items from the trash that are over
# 30 days old.
function rms {
mv "$1" ~/.Trash