Skip to content

Instantly share code, notes, and snippets.

View brucemcpherson's full-sized avatar

bruce mcpherson brucemcpherson

View GitHub Profile
@brucemcpherson
brucemcpherson / ramblings.xml
Created August 22, 2012 09:06
Under construction: manifest for all of the modules and classes used in ramblings.mcpher.com
<gistThat info="this is a manifest for gistThat VBA code distribution - see ramblings.mcpher.com for details">
<manifest description="Under construction:all of the modules &amp; classes on ramblings.mcpher.com" 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" />
@brucemcpherson
brucemcpherson / refg.vba
Created August 22, 2012 14:05
How to get the installed references in the Excel VBE
Private Sub refG()
Dim r As Reference
With ActiveWorkbook.VBProject
For Each r In .References
Debug.Print r.GUID, r.name, r.Major, r.Minor, r.description
Next r
End With
End Sub
@brucemcpherson
brucemcpherson / ub.bas
Created September 1, 2012 09:49
how to click javacript button in vba
Private Sub ubtest()
Dim f As String, linkCollection As Object, l As Object, targetText As String
' test web page
f = "http://dl.dropbox.com/u/14196218/Share/p.html"
targetText = "Show more providers"
' create browser instance
Dim browser As InternetExplorer
Set browser = CreateObject("InternetExplorer.Application").Application
/**
* dat.globe Javascript WebGL Globe Toolkit
* http://dataarts.github.com/dat.globe
*
* Copyright 2011 Data Arts Team, Google Creative Lab
*
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@brucemcpherson
brucemcpherson / cDataSet.gs
Created September 7, 2012 08:06
Google apps script equivalent for cdataset
/** @description
* javaScript/Google Apps script functions for abstracting data from sheets
* See http://ramblings.mcpher.com/Home/excelquirks/codeuse for more details
* @author <a href="mailto:bruce@mcpher.com">Bruce McPherson</a><a href="http://ramblings.mcpher.com"> ramblings.mcpher.com</a>
*/
/**
* a cDataSet
* @class
* @implements {cDataSet}
* @return {cDataSet} a new cDataSet
@brucemcpherson
brucemcpherson / cChartcontainer.gs
Created September 7, 2012 08:21
roadmapper specific stuff
//create a chart to append to roadmap
var cChartContainer = function (rt) {
var pScRoot = rt;
this.xChart = null;
this.root = function () {
return pScRoot;
};
this.chart = function () {
return this.xChart;
@brucemcpherson
brucemcpherson / cCache.gs
Created September 7, 2012 12:10
cache class for GAS
/** @description
* client caching for GAS worksheet access
* will cache all calls to get..(), set...() methods so they can be done in a single call
* a separate cache is created for each type of method (getValues,getBackGroundColors) etc.
* See http://ramblings.mcpher.com/Home/excelquirks/codeuse for more details
*/
/**
* cCache
* @author <a href="mailto:bruce@mcpher.com">Bruce McPherson</a><a href="http://ramblings.mcpher.com"> ramblings.mcpher.com</a>
@brucemcpherson
brucemcpherson / scriptdb.gs
Created September 13, 2012 12:35
scriptdb from mcpher library
/**
* @static
*/
var dbSilo;
function createDbSilos(optionalDb){
return dbSilo ?
dbSilo :
(dbSilo = new cScriptDbSilo(optionalDb));
}
@brucemcpherson
brucemcpherson / testxmlhttp.bas
Created September 17, 2012 18:26
test serverxmlhttp
Private Sub ubtest()
Dim f As String, o As Object
' this works
f = "https://script.google.com/macros/s/AKfycbw79D4L2nZ2chj9Q4bZxQPkd-nLNr1PFjyzdNHgSj_HSFGTkCc/exec?id=dev1"
Set o = CreateObject("MSXML2.ServerXMLHTTP")
Call o.Open("GET", f, False)
Call o.Send("")
Debug.Print o.ResponseText
End Sub
Private Sub ubtest2()
@brucemcpherson
brucemcpherson / getFromDistance.gs
Created October 2, 2012 13:01
lat/lon distance in GAS and VBA
// see http://www.movable-type.co.uk/scripts/latlong.html for maths
/**
* given lat, distance in km, and heading calculate new lat
* @param {number} mLat origin latitude
* @param {number} d distance in km
* @param {number} heading heading (degrees)
* @return {number} destination lat
*/
function getLatFromDistance(mLat, d , heading ) {
var lat = toRadians(mLat);