Skip to content

Instantly share code, notes, and snippets.

@blacktm
blacktm / js_builder.rb
Created April 25, 2012 20:31
A JavaScript minifier and dependency loader in Ruby.
#!/usr/bin/env ruby
# Notes:
# * Your JS files in the "manifest" will be minified using Google's Closure Compiler
# and added to the final build in the order listed.
# * Vendor libraries (like jQuery) and the "compiler.jar" must be in your
# "vendor_lib_path" directory.
# * Write your JS in modules for best results!
# Running file directly
@blacktm
blacktm / irb.rb
Created January 20, 2013 16:16
An IRB implementation in Ruby.
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
@blacktm
blacktm / data_holder-insurer.json
Last active December 27, 2015 10:09
Blue Button Data Holders
{
"organization": "String",
"category": "String",
"alias": "String",
"location": {
"address": "String",
"city": "String",
"state": "String"
},
"url": {
@blacktm
blacktm / package.rb
Created November 13, 2013 04:24
A little Ruby script to package another script as an OS X Application.
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 / ccda_allergies.json
Created November 22, 2013 23:46
CCDA to JSON translation definitions.
{
"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 / ruby_colorize.rb
Created November 25, 2013 04:25
A Ruby class extension to color shell output.
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 / data_holder.json
Last active December 29, 2015 12:09
The Blue Button Connector data holder JSON representation.
{
"organization": "String",
"category": "String",
"alias": "String",
"location": {
"street": ["String"],
"city": "String",
"state": "String",
"zip": "String",
"lat": "Number",
@blacktm
blacktm / module.js
Last active September 4, 2017 04:13
A JavaScript revealing module pattern template.
/*
* module.js - The description of the module.
*/
var Module = (function () {
// Properties
///////////////////////////
var x = 0;
@blacktm
blacktm / rename_media.rb
Created February 2, 2020 02:56
A Ruby script to rename HEIC and MOV files with date taken in Exif data on macOS
# Requires exiftool, install using Homebrew:
# brew install exiftool
require 'time'
Dir.glob('*.{heic,mov}') do |file|
puts "Renaming #{file}"
case File.extname(file)
when '.heic'
@blacktm
blacktm / package.rb
Created November 27, 2018 02:31
Create macOS app bundle from an executable file
# 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"?>