Skip to content

Instantly share code, notes, and snippets.

View agilous's full-sized avatar

Bill Barnett agilous

View GitHub Profile

ActiveRecord Demo

This gist has become cincinnatirb/active_record_demo. You can watch a (near perfect) run-through on YouTube here.

In this demo we will:

  • Revisit Rails generators
  • Learn more about Microsoft's Visual Studio Code and some of its features
  • Expand our use of git for source code control
  • Explore use of the DB Browser for SQLite to explore the internals of a SQL database
  • Be quickly introduced to Rails routing, controllers and views
  • Implement our first feature request
@agilous
agilous / ubuntu-packages-supporting-ruby-development.md
Last active June 25, 2020 19:57
Installing Ruby via asdf on Ubuntu Linux

Installing Ruby on Ubuntu Linux via asdf

1. Beginning with the Essentials & asdf

Run these commands in a terminal:

sudo apt-get install -y build-essential curl git linux-headers-`uname -r` wget
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.8
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
. ~/.bashrc
@agilous
agilous / relay_test.rb
Last active October 27, 2016 18:57
Simple TCP socket script used to test an HL7 relay app.
require 'ruby-hl7'
require 'socket'
require 'pry'
control_k = 11.chr
control_backslash = 28.chr
control_m = 13.chr
hl7 = "#{control_k}MSH|^~\&|ADM|ADMH|||201609160645|JJOHNSON|ADT^A05|597318|D|2.2|||AL|NE#{control_m}EVN|A05|201609160644|||JJOHNSON^JOHNSON^JOHNNY^M#{control_m}PID|||H000027068|||||||||||||||V00020200200#{control_m}PV1|1|P|NEPC#{control_m}PV2|||abd pain#{control_m}OBX|1|TX|ZADM.ARRIV^ARRIVAL MODE:^ADM||||||||F#{control_backslash}#{control_m}"
hl7_msg = HL7::Message.new(hl7.strip)
@agilous
agilous / flow_log_message.rb
Last active September 2, 2016 01:00
Simple Ruby class that converts Amazon Flow Log message to a hash.
class FlowLogMessage
def initialize(message)
@message = message
end
def to_hash
msg = Hash.new
msg[:version], msg[:account], msg[:interface_id], msg[:source_ip], msg[:destination_ip], msg[:source_port], msg[:destination_port], msg[:protocol], msg[:packets], msg[:bytes], msg[:window_start], msg[:window_end], msg[:action], msg[:flow_log_status] = @message.split(' ')
msg
end
@agilous
agilous / web-development-for-kids.md
Last active August 29, 2015 14:20
Web Development For Kids
@agilous
agilous / rails-3.2-to-4.0-tldr.md
Last active August 29, 2015 14:18
Ruby on Rails Upgrade TL;DR's

Rails 3.2 to 4.0 TL;DR

Thanks!

Kudos and thanks to the Rails team for producing and maintaining a high level of documentation. This TL;DR was created to speed skimming of the differences between Rails 3.2 and Rails 4.0. You are encouraged to read the complete more detailed descriptions here, especially if any items listed below appear relevant to your app.

Abbreviated Change Log

  1. The default HTTP verb is PATCH rather than PUT with a special note about JSON Patch. [[1]]
  2. The assets group has been removed from Gemfile.
  3. Support for loading plugins from vendor/plugins is removed.
  4. ActiveRecord changes include:
@agilous
agilous / heroku-response-time-parser.rb
Last active August 29, 2015 14:02
Simple Heroku log response time parser
%w(2014-06-02.log 2014-06-03.log).each do |file_name|
file = File.open(file_name, "r")
lines = 0
total_response_time = 0
file.each do |line|
response_time = line[/\b(\d{1,})ms \(/].to_i
if response_time > 0
puts "Found a response time of #{response_time} in this line: #{line}" if ARGV.size > 0
@agilous
agilous / community.md
Last active August 29, 2015 13:57
What Community Has Done For Me

What Community Has Done For Me

In the beginning...

"There's safety in numbers" as they say. As species go, Homo sapiens were not the first to figure that out. "Community" is at least a couple eons old. There's fossil evidence of communal living pre-dates the dinosaurs but I'm no paleontologist. All I can do is tell you my story.

Keybase proof

I hereby claim:

  • I am agilous on github.
  • I am agilous (https://keybase.io/agilous) on keybase.
  • I have a public key whose fingerprint is 5880 4FA6 0016 D007 944F C615 BF10 CB42 ECC5 BDB2

To claim this, I am signing this object: