Skip to content

Instantly share code, notes, and snippets.

View thogg4's full-sized avatar

Tim Hogg thogg4

  • Test Double
  • North Carolina
  • X @thogg4
View GitHub Profile

Keybase proof

I hereby claim:

  • I am thogg4 on github.
  • I am thogg4 (https://keybase.io/thogg4) on keybase.
  • I have a public key ASCWf7hOtlljk-Em8sUyd3axuZ7G9HWovCbXC3XZjsXQUQo

To claim this, I am signing this object:

======= Prolbem =================================================================================================================
I have installed : ruby-2.0.0,postgres-9.2 , now in rails app when I execute:
rake db:create , command I get:
PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT: Use the same encoding as in the template database, or use template0 as template.
: CREATE DATABASE "my_db_name" ENCODING = 'unicode'.......
bin/rake:16:in `load'
@thogg4
thogg4 / cloud-config
Last active April 3, 2016 22:22 — forked from ibuildthecloud/yaml
cloud-config for rancher-agent
#cloud-config
ssh_authorized_keys:
- ssh-rsa AAAA...
rancher:
services:
register:
privileged: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
image: rancher/agent:v0.11.0
#!/usr/bin/env ruby
git_bundles = [
"git://github.com/msanders/snipmate.vim.git",
#"git://github.com/scrooloose/nerdtree.git",
#"git://github.com/tpope/vim-haml.git",
"git://github.com/tpope/vim-markdown.git",
#"git://github.com/tpope/vim-rails.git",
#"git://github.com/tpope/vim-repeat.git",
#"git://github.com/tpope/vim-surround.git",
@thogg4
thogg4 / gist:6001878
Created July 15, 2013 17:42
speed up cursor on mac
defaults write NSGlobalDomain KeyRepeat -int 0
module ConditionalValidations
attr_accessor :validated_fields
def field_is_required?(field)
if !validated_fields.blank?
validated_fields.include?(field)
end
end
def conditionally_validate(attribute, options=nil)
# Public: Returns an Array of States (for use in Select Tags)
#
# short - (bool) If you want the function to return State Abreviations or full state names.
#
# Returns array.
def state_list(short=false)
if short
return ['AL','AK','AZ','AR','CA','CO','CT','DE','FL','GA','HI','ID','IL','IN','IA','KS','KY','LA','ME','MD','MA','MI','MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VT','VA','WA','WV','WI','WY']
else
return ['Alabama','Alaska','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','Florida','Georgia','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virginia','Wash
@thogg4
thogg4 / gist:5049028
Created February 27, 2013 16:04
Striper, for stripe
$ ->
Stripe.setPublishableKey($('meta[name="stripe-key"]').prop('content'))
Striper.init
Striper =
init: (options) ->
defaults =
form: 'form.billing'
formButton: '.billing_button'
errorContainer: '.stripe_error'
@thogg4
thogg4 / gist:4726987
Last active December 12, 2015 06:08
states/provinces
[['United States', [['Alabama', 'AL'], ['Alaska', 'AK'], ['Arizona', 'AZ'], ['Arkansas', 'AR'], ['California', 'CA'], ['Colorado', 'CO'], ['Connecticut', 'CT'], ['Delaware', 'DE'], ['District of Columbia', 'DC'], ['Florida', 'FL'], ['Georgia', 'GA'], ['Hawaii', 'HI'], ['Idaho', 'ID'], ['Illinois', 'IL'], ['Indiana', 'IN'], ['Iowa', 'IA'], ['Kansas', 'KS'], ['Kentucky', 'KY'], ['Louisiana', 'LA'], ['Maine', 'ME'], ['Maryland', 'MD'], ['Massachusetts', 'MA'], ['Michigan', 'MI'], ['Minnesota', 'MN'], ['Mississippi', 'MS'], ['Missouri', 'MO'], ['Montana', 'MT'], ['Nebraska', 'NE'], ['Nevada', 'NV'], ['New Hampshire', 'NH'], ['New Jersey', 'NJ'], ['New Mexico', 'NM'], ['New York', 'NY'], ['North Carolina', 'NC'], ['North Dakota', 'ND'], ['Ohio', 'OH'], ['Oklahoma', 'OK'], ['Oregon', 'OR'], ['Pennsylvania', 'PA'], ['Puerto Rico', 'PR'], ['Rhode Island', 'RI'], ['South Carolina', 'SC'], ['South Dakota', 'SD'], ['Tennessee', 'TN'], ['Texas', 'TX'], ['Utah', 'UT'], ['Vermont', 'VT'], ['Virginia', 'VA'], ['Washington',
@thogg4
thogg4 / except_catcher
Created January 4, 2013 04:30
rack middleware to catch exceptions
module Rack
class ExceptCatcher
def initialize(app, mailer)
@app = app
@mailer = mailer
@ignore = [404]
@hash_blacklist = %w(rack.session.options)
end
def call(env)