Skip to content

Instantly share code, notes, and snippets.

@ebot
ebot / ruby_switcher.bat
Created February 9, 2010 20:14
Switches windows ruby environment between 1.8 and 1.9.
@echo off
IF EXIST c:\ruby18 GOTO switch_19
IF EXIST c:\ruby19 GOTO switch_18
echo No alternate ruby environment found.
GOTO print_version
:switch_19
echo Switching to Ruby 1.8...
rename c:\ruby ruby19
#!/usr/bin/env ruby -wKU
require "rexml/document"
require 'FileUtils'
include REXML
# Update the xml
Dir.glob( "./*.bafxml" ) do |batch_file|
puts batch_file.to_s
doc = REXML::Document.new File.new( batch_file, 'r' )
#!/usr/bin/ruby
require 'net/smtp'
def send_mail(options = {})
begin
puts "Assembling mail..."
options = {
:smtp_server => '555.55.55.555',
:from => '[email protected]',
:to => '[email protected]',
Select e.EncounterNo, e.EncntrStartDate, EncntrType, EncntrClass, IpOpInd
From Encounters as e
Left Outer Join #valid_encounters as ve on e.EncntrOwnerId = ve.EncntrOwnerId
Where e.EncntrStartDate >= '1/1/2000' and e.EncntrStartDate < '1/1/2010'
AND ve.EncntrOwnerId is null
@ebot
ebot / gist:287035
Created January 26, 2010 17:44
Taco Bell
#!/usr/bin/env ruby -wKU
#
# A practical example of using modules is the process of making tacos.
# There are 4 main modules: main, Ingredients, Prep, and Serve
#
module TacoBell
class Tacos
def initialize(style = "Mild")
@style = style
@ebot
ebot / estimate_encounter_size.sql
Created January 14, 2010 19:06
Common EDM Queries
SELECT YEAR(ModifyDateTime) as document_year,
COUNT(TotalKB) as document_count,
(SUM(TotalKB)/1024)/1024 as document_size_gb
FROM Documents as d
INNER JOIN DocTypes as dt ON d.DocType = dt.DocType
INNER JOIN DocArchStg as das ON d.DocID = das.Docid
INNER JOIN DocsOwners as do ON d.DocId = do.DocId
INNER JOIN Encounters as e ON do.OwnerId = e.EncntrOwnerId
GROUP BY YEAR(ModifyDateTime) WITH ROLLUP
@ebot
ebot / _vimrc.conf
Created December 17, 2009 13:49
My vim configuration file.
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
@ebot
ebot / combine.rb
Created October 6, 2009 12:49
Merge seperate pdfs into one, using iText
#!/usr/bin/env ruby -wKU
require 'rubygems'
require 'fastercsv'
require 'yaml'
begin
# Gather the encounter information
map = YAML::load( File.new( 'encounter-map.yml', 'r' ) )
encounters = {}
@ebot
ebot / gist:192720
Created September 24, 2009 13:17
Converts the Backpack deinstall xml file to individual textile files per backpack page and. generates an html preview page too.
#!/usr/bin/env ruby -wKU
require 'rexml/document'
require 'rubygems'
require 'RedCloth'
include REXML
doc = Document.new( File.new( 'bpack.xml', 'r' ) )
XPath.match( doc, "//pages/page" ).each do |page|
@ebot
ebot / gist:148478
Created July 16, 2009 15:36
Lesson XML
<?xml version="1.0" encoding="UTF-8"?>
<lesson title="" lang="EN" version="">
<pages>
<page title="" number="">
<text><![CDATA[]]></text>
<overlays>
<overlay type="txt|img|swf|qt">
<source></source>
<xloc></xloc>
<yloc></yloc>