Skip to content

Instantly share code, notes, and snippets.

View zbeach's full-sized avatar

Zack Beach zbeach

View GitHub Profile
@zbeach
zbeach / .hyper.js
Last active May 10, 2023 14:45
Hyper settings
"use strict";
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
// default font size in pixels for all tabs
@zbeach
zbeach / filter.js
Last active July 2, 2022 12:13
A function that converts Data Studio Community Connector request filters to a JQL expression
/**
* Converts a Data Studio `dimensionFilters` list to a JQL expression.
* https://developers.google.com/datastudio/connector/filters
* @param {Object[]} filters A Data Studio `dimensionFilters` list
* @returns {string} a JQL expression
*/
function toJqlExpression(filters) {
return `${
filters.map(andOperand => `(
${
@zbeach
zbeach / max.js
Last active January 3, 2021 17:40
Purely functional `max`
function max(...args) {
return(
args.length === 0
? (_ => { throw new Error('No elements in array') })()
: args.length === 1
? args[0]
: (
function max(current, args) {
return (
args.length === 0
@zbeach
zbeach / part01.scm
Last active December 4, 2020 19:37
Advent of Code - Day 2
(import (chicken string))
(import (chicken io))
(define-record occurrences minimum maximum)
(define-record policy char occurrences)
(define-record password policy text)
(define string->password
(lambda (data)
((lambda (tokens)
@zbeach
zbeach / 01.js
Last active December 3, 2020 17:11
Advent of Code - Day 2
function getPassword(data) {
return (tokens => ({
policy: {
char: tokens[1].replace(':', ''),
occurrences: (occurrencesData => ({
min: occurrencesData[0],
max: occurrencesData[1]
}))(tokens[0].split('-'))
},
text: tokens[2]