Skip to content

Instantly share code, notes, and snippets.

View brucemcpherson's full-sized avatar

bruce mcpherson brucemcpherson

View GitHub Profile
@brucemcpherson
brucemcpherson / rStuff.gs
Created August 14, 2012 17:04
Basic Implementation of r-melt for Google Apps Script
// included in mcpher library - GAS key MEQ3tE5y5_cTOAgUbUKSIAiz3TLx7pV4j
// ramblings.mcpher.com
/**
* performs a melt reshape
* @param {object|string} options describes the melt actions required as either js object or jSon string
* @return {cDataSet} The populated sheet as a cDataSet
*/
function reshapeMelt (options) {
// this is a very basic start at gas implementation of Hadley Wickhams melt(R)
@brucemcpherson
brucemcpherson / rstuff.vba
Created August 15, 2012 09:13
Basic Implementation of r-melt for Excel/VBA
Option Explicit
Public Function reshapeMelt(options As String) As cDataSet
' this is a very basic start at vba implementation of Hadley Wickhams melt(R)
' http://www.statmethods.net/management/reshape.html
Dim jArgs As cJobject, ds As cDataSet, cj As cJobject, _
R As Range, ws As Worksheet, dr As cDataRow, dsOut As cDataSet, _
dc As cCell, dsre As cDataSet
' sort out the options
@brucemcpherson
brucemcpherson / vEquivalents.gs
Created August 15, 2012 10:45
Google Apps Script equivalents for common VBA function
/** @description
* javaScript/Google Apps script functions that are equivalent to common VBA functions
* in general these provide the same functionality and have the same calling stack
* 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>
*/
/**
* Removes leading and trailing whitespace
* @param {string|number} v the item to be trimmed
@brucemcpherson
brucemcpherson / ukpostcodesrest.gs
Created August 16, 2012 12:26
rest Excel/GAS library entries for uk postcodes
You can download cDataSet.xlsm from
http://ramblings.mcpher.com/Home/excelquirks/json/rest
The Google Apps script version is here
https://docs.google.com/spreadsheet/ccc?key=0At2ExLh4POiZdFAzUElyTGNQLW90aEFKeHhJZDR1WWc
(requires in mcpher library - GAS key MEQ3tE5y5_cTOAgUbUKSIAiz3TLx7pV4j
- details at https://gist.github.com/3358690)
@brucemcpherson
brucemcpherson / neildegrassetyson.gs
Created August 17, 2012 11:44
Neil deGrasse Tyson quotes API: The Daily REST library entry for Excel and GAScript
You can download cDataSet.xlsm from
http://ramblings.mcpher.com/Home/excelquirks/json/rest
The Google Apps script version is here
https://docs.google.com/spreadsheet/ccc?key=0At2ExLh4POiZdFAzUElyTGNQLW90aEFKeHhJZDR1WWc
(requires in mcpher library - GAS key MEQ3tE5y5_cTOAgUbUKSIAiz3TLx7pV4j
- details at https://gist.github.com/3358690)
@brucemcpherson
brucemcpherson / manifest.xml
Created August 20, 2012 11:59
example manifest for gistThat
<gistThat info="this is a manifest for gistThat VBA code distribution - see ramblings.mcpher.com for details"><manifest description="r-melt implementation for VBA" contact="bruce@mcpher.com"><gists><item1 gistid="3357942" version="" filename="rstuff.vba" module="rstuff"/><item2 gistid="3357942" version="" filename="rstuffsheet.vba" module="rstuffSheet"/></gists></manifest></gistThat>
@brucemcpherson
brucemcpherson / gistThat_.vba
Last active April 11, 2021 15:03
Bootstrap for gistThat_ code distributor for VBA
'IMPORTANT - CHANGE gtExampleLoad() to include gtDoit() for each Gist you want to load
' bootstrap code to update VBA modules from gists
' all code is in this module - so no classes etc.
' latebinding is used to avoid need for any references
' can be found at https://gist.github.com/3403537
Option Explicit
' v2.04 - 3403537
' if you are using your own gists - change this
Const gistOwner = "brucemcpherson"
@brucemcpherson
brucemcpherson / cCell.cls
Last active December 14, 2022 20:12
cDataSet - VBA abstraction of Excel worksheet model
'gistThat@mcpher.com :do not modify this line - see ramblings.mcpher.com for details: updated on 14/11/2013 18:02:03 : from manifest:3414394 gist https://gist.github.com/brucemcpherson/3414216/raw/cCell.cls
' a data Cell - holds value at time of loading, or can be kept fresh if there might be formula updates
Option Explicit
' Version 2.04 -
'for more about this
' http://ramblings.mcpher.com/Home/excelquirks/classeslink/data-manipulation-classes
'to contact me
' http://groups.google.com/group/excel-ramblings
'reuse of code
' http://ramblings.mcpher.com/Home/excelquirks/codeuse
@brucemcpherson
brucemcpherson / usefulStuff.vba
Last active January 25, 2022 15:58
Useful procedures and functions - usefulStuff.vba
'gistThat@mcpher.com :do not modify this line - see ramblings.mcpher.com for details: updated on 8/18/2014 3:54:19 PM : from manifest:7471153 gist https://gist.github.com/brucemcpherson/3414346/raw
Option Explicit
' v2.23 3414346
' Acknowledgement for the microtimer procedures used here to
' thanks to Charles Wheeler - http://www.decisionmodels.com/
' ---
#If VBA7 And Win64 Then
@brucemcpherson
brucemcpherson / cJobject.cls
Last active February 23, 2021 11:27
cJobject class for VBA - converts jSon/excel
'gistThat@mcpher.com :do not modify this line - see ramblings.mcpher.com for details: updated on 8/9/2014 3:09:42 PM : from manifest:3414394 gist https://gist.github.com/brucemcpherson/3414365/raw
' this is used for object serliazation. Its just basic JSON with only string data types catered for
Option Explicit
' v2.19 3414365
'for more about this
' http://ramblings.mcpher.com/Home/excelquirks/classeslink/data-manipulation-classes
'to contact me
' http://groups.google.com/group/excel-ramblings
'reuse of code
' http://ramblings.mcpher.com/Home/excelquirks/codeuse