Skip to content

Instantly share code, notes, and snippets.

View brucemcpherson's full-sized avatar

bruce mcpherson brucemcpherson

View GitHub Profile
@brucemcpherson
brucemcpherson / deadDropping.vba
Last active August 29, 2015 13:56
some example functions for deaddrop scriptdb
Option Explicit
'v1.1
' register this computer for deaddrop
Public Sub registerDeadDrop()
Dim ds As cDataSet, cc As cCell, fName As String, sf As String
Set ds = New cDataSet
With ds.populateData(wholeSheet(cGeoCodingParameters), , , True, cCustomCode)
Set cc = .cell("local register", "code")
If Not cc Is Nothing Then
@brucemcpherson
brucemcpherson / scriptDbCom.xml
Last active April 11, 2021 15:22
gistthat manifest for scriptdbcom - VBA scriptDB API
<gistThat info="this is a manifest for gistThat VBA code distribution - see ramblings.mcpher.com for details">
<manifest description="cDataset and associated classes and modules" contact="bruce@mcpher.com">
<gists>
<item1 gistid="3414216" version="" filename="cCell.cls" module="cCell" type="class" />
<item2 gistid="3414216" version="" filename="cDataSet.cls" module="cDataSet" type="class" />
<item3 gistid="3414216" version="" filename="cDataSets.cls" module="cDataSets" type="class" />
<item4 gistid="3414216" version="" filename="cDataColumn.cls" module="cDataColumn" type="class" />
<item5 gistid="3414216" version="" filename="cDataRow.cls" module="cDataRow" type="class" />
<item6 gistid="3414216" version="" filename="cHeadingRow.cls" module="cHeadingRow" type="class" />
<item7 gistid="3414346" version="" filename="" module="usefulStuff" type="module" />
'gistThat@mcpher.com :do not modify this line - see ramblings.mcpher.com for details: updated on 2/3/2014 6:52:09 PM : from manifest:8767201 gist https://gist.github.com/brucemcpherson/7943765/raw/cDeadDrop.cls
Option Explicit
' v1.2
Private pScriptDb As cScriptDbCom
Private pPackage As cJobject
Private Const deadDropKey = "xLiberationConversations"
Public Property Get willExpireAt() As Date
willExpireAt = DateAdd("n", 24 * 60, Now())
End Property
Public Property Get key() As String
@brucemcpherson
brucemcpherson / bitCoinX.vba
Last active December 30, 2015 09:19
VBA app configured with JSON. Data from bitCoin API
Option Explicit
Public Sub btcSetup()
'destroy this workbook and make an empty one
btcCreateWorkBook
btcMakeDashboard
End Sub
Public Function btcMakeDashboard(Optional dashType As String = "ticker") As Boolean
' this creates an empty dashboard based on the latest ticker values
<?xml version="1.0" encoding="UTF-8"?>
<gistThat info="this is a manifest for gistThat VBA code distribution - see ramblings.mcpher.com for details">
<manifest description="cParseCom parse.com vba API- needs cdataset and cjobject" contact="bruce@mcpher.com">
<gists>
<item1 gistid="6937529" version="" filename="usefulEncrypt.vba" module="usefulEncrypt" type="module" />
<item4 gistid="3423912" version="" filename="cBrowser.cls" module="cBrowser" type="class" />
<item5 gistid="7644016" version="" filename="parseCom.vba" module="parseCom" type="module" />
<item2 gistid="7644016" version="" filename="cParseCom.cls" module="cParseCom" type="class" />
</gists>
@brucemcpherson
brucemcpherson / cParseCom.cls
Last active December 29, 2015 08:29
VBA API for parse.com
Option Explicit
' a VBA class for parse.com
' v1.2
Private pBrowser As cBrowser
Private pPackage As cJobject
Private pClass As String
Private pApplicationHeaders As cJobject
Private pSalt As String
Private pBatch As cJobject
Private pBatchPoint As String
@brucemcpherson
brucemcpherson / UAMeasure.xml
Created November 14, 2013 17:47
gistThat manifest for UAMeasure - VBA / google analytics - http://ramblings.mcpher.com/Home/excelquirks/universalanalytics
<?xml version="1.0" encoding="UTF-8"?>
<gistThat info="this is a manifest for gistThat VBA code distribution - see ramblings.mcpher.com for details">
<manifest description="UAMeasure Protocol" contact="bruce@mcpher.com">
<gists>
<item1 gistid="6937529" version="" filename="usefulEncrypt.vba" module="usefulEncrypt" type="module" />
<item2 gistid="7453196" version="" filename="UAMeasure.vba" module="UAMeasure" type="module" />
<item3 gistid="7453152" version="" filename="cUAMeasure.cls" module="cUAMeasure" type="class" />
<item4 gistid="3423912" version="" filename="cBrowser.cls" module="cBrowser" type="class" />
<item5 gistid="3414346" version="" filename="" module="usefulStuff" type="module" />
<item6 gistid="5102369" version="" filename="cStringChunker.cls" module="cStringChunker" type="class" />
@brucemcpherson
brucemcpherson / UAMeasure.vba
Last active April 21, 2017 20:16
universal analytics measurement functions and parameters
'gistThat@mcpher.com :do not modify this line - see ramblings.mcpher.com for details: updated on 3/4/2014 2:17:37 PM : from manifest:7471153 gist https://gist.github.com/brucemcpherson/7453196/raw/UAMeasure.vba
Option Explicit
Public Sub testua()
With registerUA("developing_testua")
' do something
sleep 5
' kill session
.postAppKill
If Not .browser.isOk Then
Debug.Print .browser.status
@brucemcpherson
brucemcpherson / cUAMeasure.cls
Last active April 21, 2017 20:16
vba class for google universal analytics
'gistThat@mcpher.com :do not modify this line - see ramblings.mcpher.com for details: updated on 1/14/2014 10:38:24 AM : from manifest:7471153 gist https://gist.github.com/brucemcpherson/7453152/raw/cUAMeasure.cls
Option Explicit
'v2.2
Private pUACode As String
Private pBrowser As cBrowser
Private pID As String
Private pPostData As String
Private pUrl As String
Private pVersion As String
Private pOptOut As Boolean
Option Explicit
' see http://ramblings.mcpher.com/Home/excelquirks/regular-expressions/regexscraping
' v1.0
Public Sub halfMarathonScrape()
Dim cb As cBrowser, i As Long, headerRow As String
Dim URL As String, r As Range, heads As MatchCollection, _
t As Long, matches As MatchCollection, match As match
Dim nodeList As IHTMLElementCollection, node As IHTMLElement, _
rx As RegExp, lineLength As Long, p As Long, item As match, _