Skip to content

Instantly share code, notes, and snippets.

Jon Kinney jondkinney

Block or report user

Report or block jondkinney

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jondkinney
jondkinney / README.md
Last active Sep 24, 2019
jondkinney's console vim setup
View README.md

Console VIM and Tmux setup compatible with Mac OS X and Linux.

Installation

Install by running the following command in your terminal:

exec 3<&1;bash <&3 <(curl https://gist.githubusercontent.com/jondkinney/2040114/raw/vim.sh 2> /dev/null)
@jondkinney
jondkinney / .vimrc
Created Jan 22, 2014
Ctags in Vim. Open in a new tab or a vertical split.
View .vimrc
" open ctag in tab/vertical split
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
map <leader><C-\> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
@jondkinney
jondkinney / README.md
Created May 6, 2011 — forked from napcs/README.md
Deploying Rails to Linode
View README.md

Deploying Rails to Linode

Installing Ruby Enterprise Edition, Apache, MySQL, and Passenger for deploying Rails 3.0 applications.

Get a Linode, and set it up with Ubuntu 10.04 LTS so that you have till April 2013 to get updates. Once the Linode is formatted, boot it and continue on.

Set up an 'A' record in your DNS, pointing to the IP of your Linode. I'm using demo.napcs.com here.

Initial setup

@jondkinney
jondkinney / popen3_test
Created Sep 10, 2017 — forked from chrisn/popen3_test
Ruby example of using Open3.popen3 with a select loop to read a child process's standard output and standard error streams.
View popen3_test
#!/usr/bin/env ruby
require 'open3'
# Returns true if all files are EOF
#
def all_eof(files)
files.find { |f| !f.eof }.nil?
end
View single_quote.pl
#!/usr/bin/perl
# Script to (generate a script to) fix excess use of double-quotes in HAML.
# To use:
#
# haml-lint app/views/ > haml_errors
# grep "you don't need string interpolation" haml_errors | awk '{print $1}' > single_quote_me
# perl single_quote.pl
# bash fixme.sh
# git commit -a -m "Use single-quotes in straightforward cases"
@jondkinney
jondkinney / edgerouter-qos
Created Apr 16, 2016 — forked from beardicus/edgerouter-qos
EdgeRouter Lite QOS Settings
View edgerouter-qos
#
# fair-queue based settings for EdgeRouter Lite traffic shaping
#
# download is typically 30 and change. everything can burst to 100%
# of bandwidth, priority rules keep the garbage in check
set traffic-policy shaper download
set traffic-policy shaper download bandwidth 30Mbit
View missing_spec_generator.rb
require 'erb'
# lib/missing_spec_generator.rb
class MissingSpecGenerator
RAILS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
def spec_file spec_path, file_name, spec_template, namespace
spec_name = file_name.gsub('.rb', '') + '_spec.rb'
if File.exist?("#{spec_path}/#{spec_name}")
puts "#{spec_path}/#{spec_name} exists"
@jondkinney
jondkinney / break_out.rb
Created Jun 23, 2012
Break out of an iFrame from a controller in Rails and redirect to a relative path
View break_out.rb
render :text => "<html><body><script type='text/javascript' charset='utf-8'>parent.location.href = '/somewhere';</script></body></html>"
View tdd-and-bdd-notes.md

What is a unit in TDD - a unit of work. A use-case in the system.

http://cl.ly/RY8x

3 options for a unit of work:

  • Return Value / Exception
  • Noticable State Change (adding a user for example)
  • 3rd Party Call (only place to use mock objects?)

More than just testing the implementation of the code that you're writing, or

View vimrc_main
" Reload Google Chrome on Mac from Vim.
" Adapted from: https://github.com/gcollazo/BrowserRefresh-Sublime/
function! ChromeReload()
python << EOF
from subprocess import call
browser = """
tell application "Google Chrome" to tell the active tab of its first window
reload
end tell
"""
You can’t perform that action at this time.