Skip to content

Instantly share code, notes, and snippets.

@Capncavedan
Capncavedan / gist:8803953
Created February 4, 2014 13:55
SQL to find data in a MySQL table that is non-ASCII
SELECT whatever
FROM tableName
WHERE columnToCheck <> CONVERT(columnToCheck USING ASCII)
@Capncavedan
Capncavedan / info.md
Last active August 29, 2015 13:56
Speed up your Ruby Travis CI build with this one weird old trick ...

OK, it's two weird old tricks.

First, use their bundle caching feature. It's one line added to your .travis.yml file, and significantly speeds up test runs where you haven't changed your gem bundle - which is most of the time for most people.

See more here: http://blog.travis-ci.com/2013-12-05-speed-up-your-builds-cache-your-dependencies/

Second, do some experimentation with your Ruby garbage collection settings to speed up your local test suite runs. Examples from our development environment:

@Capncavedan
Capncavedan / gist:5f579091447da03f0b90
Created July 3, 2014 19:49
Transaction codes for Texas bonds
transaction codes for Texas
For Texas:
1 = CANCEL - Insured's option
2 = CANCEL – Non-payment of premium
3 = CANCEL - Company option
4 = Other (miscellaneous adjustments)
5 = Endorsements
6 = Audit premiums
7 = Reinstatements
@Capncavedan
Capncavedan / gist:8de9b103bc18f9999d41
Last active August 29, 2015 14:11
Hub order process vision
----------------------------------------------------------------------
Goals
----------------------------------------------------------------------
Few steps as possible to “done” & downloadable PDF
Fast! (webpage steps specifically)
Tools to prevent errors:
live previews
@Capncavedan
Capncavedan / gist:b20b9f8c94c930614428
Created March 21, 2015 01:27
Rough route notes for 150 mile gravel escapade
105th St
L on Vintage
R on 120th
L on Upland
BR on 133rd Ct
R on Kimber Ridge Ave
L on 105th
L on Badger Creek
R on 140th
R on R16 / Quail Ridge
@Capncavedan
Capncavedan / gist:2d6e62a287007aef5b32
Created July 7, 2015 21:07
moving columns in a table in postgres
this guide: https://wiki.postgresql.org/wiki/Alter_column_position#Add_columns_and_move_data
alter table financial_statements add column new_years_in_business integer, add column new_other_net_worth integer;
update financial_statements set new_years_in_business = years_in_business;
update financial_statements set new_other_net_worth = other_net_worth;
alter table financial_statements drop column years_in_business cascade, drop column other_net_worth cascade;
@Capncavedan
Capncavedan / gist:983025
Created May 20, 2011 14:32
Rider combinations for Theft Guard bonds
@http://www.pivotaltracker.com/story/show/9610041
Feature: agent orders theft guard bond
As an agent I should be able to order a theft guard bond
with only valid rider combinations
Background:
Given the fidelity bond templates
Given I'm an authenticated agent belonging to an agency
When I go to the Theft Guard products page
@Capncavedan
Capncavedan / gist:1872044
Created February 20, 2012 22:45
Useful additions to Enumerable
module Enumerable
def to_histogram
result = Hash.new(0)
each { |x| result[x] += 1 }
result
end
def most_popular
h = self.to_histogram
max_by { |x| h[x] }
@Capncavedan
Capncavedan / gist:1876924
Created February 21, 2012 14:52
Installing MySQL 2.8.1 gem
env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
@Capncavedan
Capncavedan / gist:1932894
Created February 28, 2012 14:41
How to create a set of ImageRight diary items
# UPDATED May 16 2012 for ImageRight v5
# How to generate a set of diary items for agencies
# Use rails console, paste list of agency ids into %w below
# Adjust other parameters as appropriate
# IMPORTANT: left pad with zeros to make agency ids 5 digits
agency_ids = %w( ).map{|a| a.to_s.rjust(5, '0')}.uniq.sort
diary_items = []