Skip to content

Instantly share code, notes, and snippets.

@timharding
timharding / fix-libv8-mac.txt
Created May 8, 2019 06:16 — forked from fernandoaleman/fix-libv8-mac.txt
Fixing libv8 and therubyracer on Mac
brew tap homebrew/versions
brew install v8-315
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315
bundle install
Rails.application.eager_load! if Rails.env.development?
ActiveRecord::Base.descendants.each do |d|
puts d.table_name
d.columns_hash.each do |f, t|
if t.type == :string || t.type == :text
puts "\t#{f} #{t.type}"
queries = []
queries << "#{f} = replace(#{f}, '“', '“')"
queries << "#{f} = replace(#{f}, '’', '’')"
queries << "#{f} = replace(#{f}, '‘', '‘')"
@timharding
timharding / gist:40433fd3a8a81361a444
Created January 21, 2015 12:23
uninitialized constant ActiveSupport::Deprecation (NameError)
tim@factory:~/Documents/Development/icehitman (master)$ AUTOFEATURE=true bundle exec autotest
loading autotest/cucumber_rails_rspec
/usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/core_ext/module/deprecation.rb:21:in `deprecate': uninitialized constant ActiveSupport::Deprecation (NameError)
from /usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/core_ext/class/delegating_attributes.rb:26:in `<class:Class>'
from /usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/core_ext/class/delegating_attributes.rb:6:in `<top (required)>'
from /usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/core_ext/class.rb:2:in `require'
from /usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/core_ext/class.rb:2:in `<top (required)>'
from /usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems
@timharding
timharding / circle_ci_to_engine_yard_deployment.md
Last active December 14, 2016 12:54
CircleCI to Engine Yard Continuous Deployment

Configuring CircleCI to deploy to Engine Yard

Preamble

This is a brief description of how to get CircleCI builds deployed to an Engine Yard hosted staging environment automatically.

We're essentially asking CircleCI to execute commands on the Engine Yard gem to ask EY to deploy a Rails app.

CircleCI needs an SSH key and an API token to talk to Engine Yard, at that point you can execute the deploy command on the gem when the build succeeds.

@timharding
timharding / keybase.md
Created April 7, 2014 13:42
keybase.md

Keybase proof

I hereby claim:

  • I am timharding on github.
  • I am timharding (https://keybase.io/timharding) on keybase.
  • I have a public key whose fingerprint is CF14 B361 CE72 A2C1 4220 6BB2 388D EED8 6E61 220B

To claim this, I am signing this object:

@timharding
timharding / verifying_a_download.txt
Created February 23, 2014 23:56
Quick instructions for verifying a downloaded file
# verifying an md5 checksum...
md5 electrum-1.9.7.dmg
# then compare checksum
# verifying a gpg sig...
# 1. find the hex key id for the signer's public key
gpg --recv-keys 0x22453004695506FD
# 2. download the file and the .asc signature file for that file then
# 3. validate the file
gpg --verify electrum-1.9.7.dmg{.asc.txt,}
RAW_POST_DATA
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<probe type=\"yaml\"><![CDATA[\n--- !ruby/object:Time {}\n\n]]></probe>"
REMOTE_ADDR
"188.120.254.74"
@timharding
timharding / iotu.rb
Last active December 10, 2015 11:18
A program that merges together the various archive and current feeds for In Our Time with Melvyn Bragg and delivers one feed with all the programmes ordered by broadcast date.
# a program that merges together the various archive and current
# feeds for In Our Time with Melvyn Bragg and delivers one feed
# with all the programmes ordered by broadcast date.
# this was very helpful
# http://www.subelsky.com/2007/08/roll-your-own-podcast-feed-with-rails.html
require 'rss'
require 'open-uri'
@timharding
timharding / thin_hello_world.rb
Created November 3, 2011 22:35
Thin hello world...
app = proc do |env|
[
200,
{
'Content-Type' => 'text/html',
'Content-Length' => '2'
},
'Hi!'
]
end
@timharding
timharding / event_machine_hellow_world.rb
Created November 3, 2011 22:12
EventMachine hello world...
require 'rubygems'
require 'eventmachine'
require 'evma_httpserver'
class Handler < EventMachine::Connection
include EventMachine::HttpServer
def process_http_request
resp = EventMachine::DelegatedHttpResponse.new( self )