Skip to content

Instantly share code, notes, and snippets.

Tom Black blacktm

Block or report user

Report or block blacktm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@blacktm
blacktm / package.rb
Created Nov 27, 2018
Create macOS app bundle from an executable file
View package.rb
# Run this script using `ruby package.rb` with an executable named `app`
# in a `build/` directory.
# Build an app bundle for macOS
def build_macos_package
require 'fileutils'
info_plist = %(
<?xml version="1.0" encoding="UTF-8"?>
@blacktm
blacktm / install_ruby_macos.sh
Last active May 15, 2019
A Bash script to install Ruby on macOS
View install_ruby_macos.sh
#!/bin/bash
brew update
brew install rbenv ruby-build
read -d '' String <<"EOF"
# rbenv
eval "$(rbenv init -)"
EOF
@blacktm
blacktm / install_ruby_rpi.sh
Last active Aug 14, 2019
A Bash script to install Ruby 2.6 on the Raspberry Pi (Raspbian)
View install_ruby_rpi.sh
#!/bin/bash
# --------------------------------------------------------------------------------------------
# Installs Ruby 2.6 using rbenv/ruby-build on the Raspberry Pi (Raspbian)
#
# Run from the web:
# bash <(curl -s https://gist.githubusercontent.com/blacktm/8302741/raw/install_ruby_rpi.sh)
# --------------------------------------------------------------------------------------------
# Welcome message
@blacktm
blacktm / module.js
Last active Sep 4, 2017
A JavaScript revealing module pattern template.
View module.js
/*
* module.js - The description of the module.
*/
var Module = (function () {
// Properties
///////////////////////////
var x = 0;
@blacktm
blacktm / data_holder.json
Last active Dec 29, 2015
The Blue Button Connector data holder JSON representation.
View data_holder.json
{
"organization": "String",
"category": "String",
"alias": "String",
"location": {
"street": ["String"],
"city": "String",
"state": "String",
"zip": "String",
"lat": "Number",
@blacktm
blacktm / ruby_colorize.rb
Created Nov 25, 2013
A Ruby class extension to color shell output.
View ruby_colorize.rb
class String
def colorize(c); "\e[#{c}m#{self}\e[0m" end
def error; colorize("1;31") end
def bold; colorize("1") end
end
@blacktm
blacktm / ccda_allergies.json
Created Nov 22, 2013
CCDA to JSON translation definitions.
View ccda_allergies.json
{
"date_range": {
"start": "templateId[root='2.16.840.1.113883.10.20.22.2.6.1'] > effectiveTime > low.value",
"end": "templateId[root='2.16.840.1.113883.10.20.22.2.6.1'] > effectiveTime > high.value"
},
"name": "templateId[root='2.16.840.1.113883.10.20.22.4.7'] > code.displayName",
"code": "templateId[root='2.16.840.1.113883.10.20.22.4.7'] > code.code",
"code_system": "templateId[root='2.16.840.1.113883.10.20.22.4.7'] > code.codeSystem",
"code_system_name": "templateId[root='2.16.840.1.113883.10.20.22.4.7'] > code.codeSystemName",
"status": "templateId[root='2.16.840.1.113883.10.20.22.4.28'] > value.displayName",
@blacktm
blacktm / package.rb
Created Nov 13, 2013
A little Ruby script to package another script as an OS X Application.
View package.rb
require 'fileutils'
if Dir.exists? "App.app"
puts "Nope"
exit
end
FileUtils.mkpath "App.app/Contents/MacOS"
FileUtils.mkpath "App.app/Contents/Resources"
@blacktm
blacktm / data_holder-insurer.json
Last active Dec 27, 2015
Blue Button Data Holders
View data_holder-insurer.json
{
"organization": "String",
"category": "String",
"alias": "String",
"location": {
"address": "String",
"city": "String",
"state": "String"
},
"url": {
@blacktm
blacktm / irb.rb
Created Jan 20, 2013
An IRB implementation in Ruby.
View irb.rb
require 'readline'
first_run = true
loop do
if first_run
puts
puts "Type a command to get started."
puts "Type \"exit\" to quit."
first_run = false
You can’t perform that action at this time.