Skip to content

Instantly share code, notes, and snippets.

View stephlocke's full-sized avatar

Steph Locke stephlocke

View GitHub Profile
@stephlocke
stephlocke / git.md
Created August 8, 2022 14:22
A brief intro to Git!

Source control

Source control concepts

Source control is a system for tracking changes to files over time.

What's the point?

  • No version hell
@stephlocke
stephlocke / twittermgmt.R
Last active February 16, 2022 14:28
A gist demonstrating how to retrieve the people you follow, assign them to lists, and unfollow in batches
library(rtweet) #' uses v0.7.0.9012 or higher
library(tidyverse)
## authenticate via web browser
auth_setup_default()
## people i follow
follow <- get_friends("theStephLocke")
## their user data
follow_deets <- lookup_users(follow$to_id)
@stephlocke
stephlocke / example.yaml
Created December 1, 2020 11:46
gh actione xample
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 November 9, 2020 09:09
Get and transform NomCom table in Power Query
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 January 6, 2020 17:09
Quickly allocate some groups into partitions with other groups of similar size
# 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){
yo
---
title: "First dash"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
runtime: shiny
---
```{r setup, include=FALSE}
{
"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?"
],
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 December 21, 2018 15:39
Work with hubspot data
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/")