Skip to content

Instantly share code, notes, and snippets.

Avatar

Steph Locke stephlocke

View GitHub Profile
View example.yaml
name: Generate Word docs
on: push
jobs:
convert_via_pandoc:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: convert md to docx
uses: docker://pandoc/latex:2.9
@stephlocke
stephlocke / extract.pq
Created Nov 9, 2020
Get and transform NomCom table in Power Query
View extract.pq
let
Source = Web.Page(Web.Contents("https://www.pass.org/Governance/Elections")),
Data5 = Source{5}[Data],
#"Changed Type" = Table.TransformColumnTypes(Data5,{{"", type text}, {"Joey D'Antoni", type number}, {"Lori Edwards", type number}, {"Roberto Fonseca", type number}, {"Matt Gordon", type number}, {"Stephanie Locke", type number}, {"Jose L. Rivera", type number}, {"Hamish Watson", type number}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"", "Area"}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Renamed Columns", {"Area"}, "Attribute", "Value"),
#"Renamed Columns1" = Table.RenameColumns(#"Unpivoted Other Columns",{{"Attribute", "Candidate"}})
in
#"Renamed Columns1"
@stephlocke
stephlocke / grouping.r
Created Jan 6, 2020
Quickly allocate some groups into partitions with other groups of similar size
View grouping.r
# Generate sample distributions
n = 1e2
t = 3e6
min_r = t/1000
max_r = t/50
c = 0
r = vector(mode="numeric")
for(x in 1:n){
View file531c2cc66751.R
---
title: "First dash"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
runtime: shiny
---
```{r setup, include=FALSE}
View CreateKbDTO.json
{
"name": "QnA Maker FAQ",
"qnaList": [
{
"id": 0,
"answer": "You can change the default message if you use QnAMakerDialog. See this for details https://docs.botframework.com/en-us/azure-bot-service/template",
"source": "Custom Editorial",
"questions": [
"How can I change the default message from QnA Maker?"
],
View datasauRus.R
library(hexSticker)
library(datasauRus)
library(ggplot2)
library(dplyr)
library(svglite)
p <- ggplot(aes(x, y), data = datasaurus_dozen) +
geom_point(colour = "khaki",
alpha = .1,
size = 1) +
@stephlocke
stephlocke / hubspot.R
Last active Dec 21, 2018
Work with hubspot data
View hubspot.R
library(httr)
library(purrr)
library(dplyr)
library(tidyr)
apikey="demo"
get_deal_properties = function(apikey="demo"){
base_url = "https://api.hubapi.com"
properties_url = modify_url(base_url,
path ="/properties/v1/deals/properties/")
View basic.R
# Load R packages for use
library("dplyr")
library("recipes")
library("rsample")
library("broom")
library("jsonlite")
library("sessioninfo")
# Sample data
sm_iris = initial_split(iris)
@stephlocke
stephlocke / recursinghubspot.pq
Last active Nov 2, 2018
recursing through the hubspot deals api
View recursinghubspot.pq
let
iterations = 10, // Number of iterations
url =
"https://api.hubapi.com/deals/v1/deal/paged?" & "hapikey=demo" & "&includeAssociations=true" & "&limit=1" & "&properties=dealname" & "&propertiesWithHistory=true"
,
FnGetOnePage =
(url) as record =>
let
Source = Json.Document(Web.Contents(url)),
data = try Source[deals] otherwise null,