Skip to content

Instantly share code, notes, and snippets.

View StephenOTT's full-sized avatar
:shipit:
...

Stephen Russett StephenOTT

:shipit:
...
View GitHub Profile
@StephenOTT
StephenOTT / gist:6303277
Created August 22, 2013 04:39
Health Inspection Parsed XML into Ruby Hash/Arrays - Single Restaurant
[{"numFound"=>"1",
"start"=>"0",
"doc"=>
[{"str"=>
{"app_id"=>"fsi",
"fs_fa_en"=>"Ottawa West",
"fs_fa_fr"=>"Ottawa Ouest",
"fs_facd"=>"OTW",
"fs_faid"=>"9DC7C571-6145-47B1-B837-85E1F6A26244",
"fs_fcr"=>"YES",
@StephenOTT
StephenOTT / gist:6303243
Created August 22, 2013 04:30
Health Inspection XML sample from a single Restaurant
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/templates/xslt/inspections/inspections_details_en.xsl"?>
<response>
<result numFound="1" start="0">
<doc>
<str name="app_id">fsi</str>
<str name="fs_fa_en">Ottawa West</str>
<str name="fs_fa_fr">Ottawa Ouest</str>
<str name="fs_facd">OTW</str>
<str name="fs_faid">9DC7C571-6145-47B1-B837-85E1F6A26244</str>
@StephenOTT
StephenOTT / gist:6254185
Last active December 21, 2015 05:08
Sample of code for converting date/times to a proper format for import into Mongodb
issues.each do |y|
y["created_at"] = DateTime.strptime(y["created_at"], '%Y-%m-%dT%H:%M:%S%z').to_time.utc
y["updated_at"] = DateTime.strptime(y["updated_at"], '%Y-%m-%dT%H:%M:%S%z').to_time.utc
if y["closed_at"] != nil
y["closed_at"] = DateTime.strptime(y["closed_at"], '%Y-%m-%dT%H:%M:%S%z').to_time.utc
end
end
@StephenOTT
StephenOTT / gist:4260308
Created December 11, 2012 17:01
Find and Replace values in column with array values - Excel
Sub Macro1()
findArray = Array("/01/", "/02/", "/03/", "/04/", "/05/", "/06/", "/07/", "/08/", "/09/", "/10/", "/11/", "/12/")
replArray = Array("/Jan/", "/Feb/", "/Mar/", "/Apr/", "/May/", "/Jun/", "/Jul/", "/Aug/", "/Sep/", "/Oct/", "/Nov/", "/Dec/")
For i = 0 To UBound(findArray)
Selection.EntireColumn.Select
Selection.Replace What:=findArray(i), Replacement:=replArray(i), LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
@StephenOTT
StephenOTT / gist:3909199
Created October 18, 2012 00:35
Excel function to grab the file name and extension from a URL
=REPLACE(A1,1,LOOKUP(2^15,FIND("/",A1,ROW(INDIRECT("1:"&LEN(A1))))),"")