Skip to content

Instantly share code, notes, and snippets.

View tonmcg's full-sized avatar

Tony McGovern tonmcg

View GitHub Profile
// v2
/* UPDATE 13/02/2022
Added columns argument and made each optional
*/
// Returns an array of unique random numbers
RANDUNIQUE =
LAMBDA([rows],[columns],[min],[max],
@andyweiss1982
andyweiss1982 / Dad Joke API Example.EXCEL.yaml
Created October 30, 2020 19:37
Very basic implementation of fetching data and putting into Excel
name: Dad Joke API Example
description: Very basic implementation of fetching data and putting into Excel
host: EXCEL
api_set: {}
script:
content: |
const button = document.querySelector("button");
button.addEventListener("click", run);
async function getRandomDadJoke(){
library(tidycensus)
library(leaflet)
library(sf)
library(viridis)
options(tigris_use_cache = TRUE)
il1 <- get_acs(geography = "county",
variables = c(hhincome = "B19013_001"),
state = "IL",
geometry = TRUE) %>%
@zross
zross / non-gis-y-webmapping.md
Last active February 8, 2019 18:01
Web mapping applications with multiple layers

Suggestions from Twitter for more "elegant" web mapping applications

Specifically I'm looking for web mapping applications that include multiple layers and don't look like an ArcGIS clone -- perhaps something that looks like it was designed by a designer rather than a GIS tech :) This is a list of responses from Twitter, many of which do look GIS-y so more suggestions are welcome...

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MarkTiedemann
MarkTiedemann / power-query-pagination.m
Last active March 5, 2024 23:43
Power Query Pagination Example
let
BaseUrl = "https://fake-odata-api.com/v1/Entities?",
Token = "F4K3-T0K3N-D0NT-U5E-L0L",
EntitiesPerPage = 1000,
GetJson = (Url) =>
let Options = [Headers=[ #"Authorization" = "Bearer " & Token ]],
RawData = Web.Contents(Url, Options),
Json = Json.Document(RawData)
in Json,
@oscarperpinan
oscarperpinan / code_without_ggplot2.R
Last active December 20, 2019 10:43
beautiful-thematic-maps: alternative code without using ggplot2
## https://timogrossenbacher.ch/2016/12/beautiful-thematic-maps-with-ggplot2-only/
library(raster)
library(sp)
library(rgdal)
library(viridisLite)
library(rasterVis)
## Read age data
data <- read.csv("input/avg_age_15.csv", stringsAsFactors = F)
## Read shapefile
@mckneisler
mckneisler / QuickBooksOnline Code.txt
Last active August 27, 2024 17:41
QuickBooks Online API Example for VBA
Public Function quote(sString As String) As String
quote = Chr(34) + sString + Chr(34)
End Function
Public Function URLEncode(sString As String) As String
Dim iLen As Integer
iLen = Len(sString)
If iLen > 0 Then
ReDim sResult(iLen) As String
@CurtHagenlocher
CurtHagenlocher / multipart.m
Created July 20, 2015 20:18
Using multipart/form-data with Power Query. This assumes that any files being uploaded are textual; changing this to support arbitrary binary data is possible, but wasn't interesting to me.
let
Web.MultiPartPost = (url as text, parts as record) as binary =>
let
unique = Text.NewGuid(),
boundary = "--" & unique,
crlf = "#(cr)#(lf)",
item = (name, value) =>
let
filename = Value.Metadata(value)[name]?,
contentType = Value.Metadata(value)[type]?,
@CurtHagenlocher
CurtHagenlocher / Web.ContentsCustomRetry.m
Created April 30, 2015 13:08
Demonstrates the use of a custom retry duration with Web.Contents.
let
Value.WaitFor = (producer as function, interval as function, optional count as number) as any =>
let
list = List.Generate(
() => {0, null},
(state) => state{0} <> null and (count = null or state{0} < count),
(state) => if state{1} <> null
then {null, state{1}}
else {1 + state{0}, Function.InvokeAfter(() => producer(state{0}), interval(state{0}))},
(state) => state{1})