Skip to content

Instantly share code, notes, and snippets.

View nacengineer's full-sized avatar

David Southard nacengineer

  • UW Madison, General Library System
  • Madison, WI
  • 11:19 (UTC -05:00)
View GitHub Profile
alias Person
{:ok, xml} =
["people.xml"]
|> Path.join()
|> File.read()
people = Person.map(xml)
IO.inspect(people)
@nacengineer
nacengineer / Dockerfile
Last active November 15, 2019 21:01
Typical Rails + Docker Desktop Setup
FROM ruby:2.5-alpine
RUN apk add --update \
bash \
build-base \
nodejs \
postgresql-dev \
postgresql-client \
libxml2-dev \
libxslt-dev \
@nacengineer
nacengineer / Gemfile
Last active April 12, 2019 16:51
Rails 5.2 Default Gemfile
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# ruby '2.4.6' # lock to your version should you so choose
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
@nacengineer
nacengineer / Gemfile
Created April 12, 2019 16:21
Rails 5.1 Default Gemfile
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.0'
@nacengineer
nacengineer / cullSchedule.js
Last active February 28, 2018 17:31
Reformat Schedule on http://el-una.org/
// Copyright (c) 2017-2018, Dave Southard
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
@nacengineer
nacengineer / How To Move.md
Last active August 29, 2015 14:16
Move from one Database style to Postgres

Rails 3.1+ can handle Multiple Connections

Create model to handle the old connection. For this example we've pivoted to the new database and will be connecting to the old database

Create an database setting in your database.yml

For the purposes of this example we're going to call it OldModel

Copy your current models to a new subdirectory in /app/models/

# using https://gist.github.com/agrimm/1053502 on Mac Pro 2014
=begin
ruby-1.8.7-head 1.8.7
==============================
user system total real
Block (0) 0.210000 0.000000 0.210000 ( 0.215018)
Pre-exing proc (0) 0.240000 0.000000 0.240000 ( 0.232736)
New Symbol#to_proc (0) 0.360000 0.000000 0.360000 ( 0.360474)
Old Symbol#to_proc (0) 1.370000 0.060000 1.430000 ( 1.441742)
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
@nacengineer
nacengineer / fix-vmware-headers.md
Last active August 29, 2015 13:57
Fix the Linux Headers for install of VMWare Sphere Virtual Tools

Ensure Headers are Installed

sudo apt-get update && sudo apt-get install build-essential linux-headers-$(uname -r)

Symlink Headers

sudo ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h
$ irb
# sample array of slots
rbx-2.2.5 :001 > a = %w[slot1 slot3]
=> ["slot1", "slot3"]
# require our class, in this case called section
rbx-2.2.5 :002 > require './lib/section.rb'
=> true