Skip to content

Instantly share code, notes, and snippets.

View beechnut's full-sized avatar

Matt Cloyd beechnut

  • 18F (work) + personal projects
  • Philadelphia, PA
View GitHub Profile
@beechnut
beechnut / README.md
Last active September 20, 2023 19:45
SheetSupport – Make spreadsheets readable with custom formulas

SheetSupport – Make spreadsheets readable with custom formulas

SheetSupport is a library of Google Sheets custom formulas, inspired by Ruby's Enumerable module and Rails' ActiveSupport

What / Why?

These functions are meant to make your spreadsheets more readable, better understood, and more easily maintained.

Here's an example of a formula that:

  • Looks up a value
@beechnut
beechnut / README.md
Created August 23, 2022 14:58
I forgot the password to my local SonarQube instance and now I'm locked out

Reset SonarQube admin password

Did you forget the admin password for your local Dockerized instance of SonarQube? Do you have a lot of scans done that you need for a vendor evaluation?

We've all been there. (Well, all of us who found this Gist maybe.)

If you're using Docker, go to your Docker dashboard and run an interactive terminal session. This will open a terminal window with a command like this:

docker exec -it {Container ID} /bin/sh
@beechnut
beechnut / keybase.md
Created March 30, 2020 17:22
Keybase to prove my identity

Keybase proof

I hereby claim:

  • I am beechnut on github.
  • I am mattjcloyd (https://keybase.io/mattjcloyd) on keybase.
  • I have a public key ASBZAMXoS6BKL4E2gytA-T3yNI7Z5Xg2-v-vWUbFLHdANAo

To claim this, I am signing this object:

@beechnut
beechnut / gem_make.out
Created August 29, 2017 14:26
GDAL is failing to compile (zoning.io)
/Users/matt/.rubies/ruby-2.2.3/bin/ruby -r ./siteconf20170829-5441-z90xo9.rb extconf.rb
checking for main() in -lgdal... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling osr.cpp
In file included from osr.cpp:1888:
In file included from /Applications/Postgres.app/Contents/Versions/9.6/include/cpl_string.h:35:
@beechnut
beechnut / wish-knew.md
Last active August 29, 2015 14:17
What I wish people new about coding

What I wish people knew about coding, including beginner programmers.

  • Coding isn't mystical.
    • Don't revere developers.
  • Getting started is hard, especially if you don't have a community of real, live people to help you out.
    • StackOverflow doesn't count. Meetups do.
  • The gap between the code you see on GitHub and running code is often massive. If you can't get a relatively simple codebase running quickly, it's probably because the developer assumes a lot about your system, not because you've done something wrong.
  • If code looks messy and scatterbrained, it probably is.
  • Read Ruby books. Avdi Grimm and Sandi Metz have a lot of important things you should read, whether you write Ruby or not.
  • So-called '10x programmers' leave 10x the technical debt of other programmers. The 10x myth has a cost.
@beechnut
beechnut / flatten_with_path.rb
Created March 2, 2015 19:10
Flatten hashes recursively
# From http://stackoverflow.com/questions/16497719/flatten-a-nested-hash-in-ruby-on-rails
module Enumerable
def flatten_with_path(parent_prefix = nil)
res = {}
self.each_with_index do |elem, i|
if elem.is_a?(Array)
k, v = elem
else
@beechnut
beechnut / sociogeoruby.md
Last active August 29, 2015 14:06
Social Influence, Equity, and Geospatial Ruby

This talk will present a vision for how our tutorials and code examples can influence new developers in ways beyond helping them to code, and exposing them to new ideas and making the ideologies embedded within code clearer. I will make a case for and present several ways we might develop the equivalent of 'media literacy' in code.

Ruby doesn't yet have geospatial libraries, but there's a new movement of developers to make mapping platforms and tile servers as easy to build as a Rails apps.

Rubyists represent an interesting demographic because so many of them -- myself included -- are new programmers, coming in from MOOCs like CodeAcademy or accelerators like LaunchAcademy. Code examples include Ten-Minute Blogs and Twitter clones, and are generally considered ideology-neutral. However, these examples have their own ideologies, and code examples could be more conscious of and deliberate about the ideas they present. Tutorials be could a place to influence new programmers, nudging them towrds doing work for

@beechnut
beechnut / backtick-surround.js
Last active December 6, 2021 06:11
Surround with backticks in Sublime Text 3
// Copy the following into Preferences > Key Bindings -- User
// Thanks to:
// http://sublimetext.userecho.com/topic/86166-backtick-quoting-selected-text-does-not-work-like-single-quotes-and-double-quotes/
[
// Auto-pair backticks
{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0`"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
@beechnut
beechnut / README.md
Created April 2, 2014 22:26
A First Attempt at Multi-Table Models in Rails

Multi-Table Models in Rails (without Rails for now)

I have Census datasets that store attributes in three separate files, corresponding to three separate summary levels, or spatial resolutions -- in this case, Municipalities, Census Tracts, and Census Blockgroups.

It's not the Rails way: I know. But it's not anybody else's way -- not even GeoNode has solved the problem of having attribute data separate from spatial data and joining them on the fly to one of several possible geographies.

I'd love to be able to write

# Set environment to development unless something else is specified.
env = ENV['RAILS_ENV'] || 'development'
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for documentation
worker_processes 4
# listen on both a Unix domain socket and a TCP port,
# we use a shorter backlog for quicker failover when busy
listen '/tmp/regionalindicators.socket', backlog: 64