Skip to content

Instantly share code, notes, and snippets.

View claytron's full-sized avatar
😎
My future is so bright.

Clayton Parker claytron

😎
My future is so bright.
View GitHub Profile
@claytron
claytron / delayed_job_error_escalate.rb
Created March 14, 2017 20:43
Show how long a DelayedJob will take to finish out its attempts
def human_time(t)
mm, ss = t.divmod(60)
hh, mm = mm.divmod(60)
dd, hh = hh.divmod(24)
"#{dd}d #{hh}h #{mm}m #{ss}s"
end
# Default attempts is 25
max_attempts = ARGV[0] ? ARGV[0].to_i : 25
cumulative_time = 0
@claytron
claytron / fzf.sh
Created January 23, 2016 22:38
FZF Config
# My defaults for FZF (mostly changed to see hidden files)
export FZF_DEFAULT_COMMAND='find -L . -type f -o -type d -o -type l | sed 1d | cut -b3- | grep -v -e .git/ -e .svn/ -e .hg/'
export FZF_CTRL_T_COMMAND=$FZF_DEFAULT_COMMAND
# Enhance the default experience
export FZF_DEFAULT_OPTS='--extended --multi --inline-info --prompt="fzf> "'
@claytron
claytron / mru.vim
Created January 23, 2016 22:22
Most Recently Used Buffer search using FZF in Vim
" Use 'ffr' in normal mode to start it
nmap ffr :MRUFilesCWD<CR>
" MRU handling, limited to current directory
command! MRUFilesCWD call fzf#run({
\ 'source': s:mru_files_for_cwd(),
\ 'sink': 'edit',
\ 'options': '-m -x +s --prompt=MRU:'.shellescape(pathshorten(getcwd())).'/',
\ 'down': '40%' })
@claytron
claytron / metrics.sh
Created January 8, 2016 16:48
Get rubocop metrics details
#!/usr/bin/env bash
# Example output:
#
# Metrics/PerceivedComplexity
# Min: 8 Max: 96 Average: 14.628342
cops=(
Metrics/AbcSize
Metrics/ClassLength
@claytron
claytron / pre-commit
Last active August 29, 2015 14:18 — forked from mileszs/pre-commit
#!/usr/bin/env ruby
hits = []
checks = {
#'_spec\.rb$' => ['focus:[:space:]*true'],
'\.rb$' => ['binding\.pry', 'debugger']
}
# Find the names of all the filenames that have been (A)dded (C)opied or (M)odified
filenames = `git diff --cached --name-only --diff-filter=ACM`.split("\n")
@claytron
claytron / clearly.conf
Last active August 29, 2015 14:17
Clearly Solarized Dark Config
## Settings in Clearly plugin
Body font: Droid Sans
Header font: Ubuntu
Monospace font: Inconsolata
Background Color: #002b36
Foreground Color: #839496
Links Color: #b58900
Base font size: 22pt
Line height: 1.4em
Line width: 32em
@claytron
claytron / init.yml
Last active August 29, 2015 14:02 — forked from renoirb/init.yml
#
# How to install automatically Oracle Java 7 under Salt Stack
#
# Thanks Oracle for complicating things :(
#
# 1. Create a java/ folder in your salt master
# 2. Paste this file in init.sls
# 3. salt '*' state.sls java
#
# Source:

Keybase proof

I hereby claim:

  • I am claytron on github.
  • I am claytron (https://keybase.io/claytron) on keybase.
  • I have a public key whose fingerprint is EDF7 946A 1F6F 1CBF F55D 9E3F 5098 437C 05A9 EEB5

To claim this, I am signing this object:

@claytron
claytron / plone.app.toolbar
Created July 14, 2013 17:00
Merge of plone.app.toolbar and plone.app.widgets issues into mockup tracker
Could not create label Bug
Could not create label Feature
Could not create label toolbar
Loaded issues 1 29
Loaded issues 2 0
Importing issue Personal-tools should come last in the DOM of the toolbar (127)
Successfully created issue Personal-tools should come last in the DOM of the toolbar (45)
Successfully imported comments in Personal-tools should come last in the DOM of the toolbar (45)
Importing issue Upon edit success, page should reload if #portal-column-content is not found (126)
@claytron
claytron / mirror-repos.py
Created January 18, 2013 23:57
Script to mirror repos from an organization
#!/usr/local/bin/python
# this script gets the JSON from api.github for a user
# and mirrors (or fetches, for existing) that user's repos
import os
import sys
import json
import urllib2
import subprocess