Skip to content

Instantly share code, notes, and snippets.

View mzagaja's full-sized avatar

Matthew Zagaja mzagaja

View GitHub Profile
{
"auto_complete_commit_on_tab": true,
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
{
"auto_complete_commit_on_tab": true,
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_face": "Fira Mono",
"ignored_packages":
[
"Markdown",
"Vintage"
],
#
# systemd unit file for CentOS 7, Ubuntu 15.04
#
# Customize this file based on your bundler location, app directory, etc.
# Put this in /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu).
# Run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
# This file corresponds to a single Sidekiq process. Add multiple copies
-d postgresql
-T
-C
--skip-turbolinks
--skip-coffee
--webpack=react
-m ~/Developer/mjz_rails_template.rb
@mzagaja
mzagaja / install-version-managers.sh
Last active January 29, 2020 21:16
Fish Shell Install Version Managers
#! /usr/bin/fish
curl -sSL https://get.rvm.io | bash -s stable
curl -L --create-dirs -o ~/.config/fish/functions/rvm.fish https://raw.github.com/lunks/fish-nuggets/master/functions/rvm.fish
echo "rvm default" >> ~/.config/fish/config.fish
# brew install python@2 python
pip install virtualfish
'eval (python -m virtualfish)' >> ~/.config/fish/config.fish
# Matt Zagaja Rails Template
gem_group :development, :test do
gem 'dotenv-rails'
gem 'factory_bot_rails'
gem 'pry-byebug'
gem 'rspec-rails'
end
gem_group :development do
gem 'capistrano', '~> 3.10', require: false

Latitude and Longitude

Well Known Text

POINT(X Y), X is latitude and Y is longitude

For ESRI Lat = Y Long = X

GDAL X= longtiude Y = latitude

Connecting to Google Analytics API - A Journey

There is a Google Ruby client for doing this. They also have documentation.

  1. Follow the instructions for creating a service account.
  2. Add the service account to your Google Analytics account user list.
  3. Create a Project for your new API project if you wish. I usually do and name it something related to the project.
  4. Create a service account.
  5. Enable the Google Analytics Reporting API
  6. In GSuite Domain Security Settings go to API Controls and check "Trust internal, domain-owned apps."

Import House Districts

ogr2ogr -f 'PostgreSQL' PG:"dbname=ctnj-vote_development user=mzagaja" housect_37800_0000_2010_s100_census_1_shp_wgs84.shp -nlt MULTIPOLYGON -nln ct_house_districts
system({dbname: Rails.configuration.database_configuration[Rails.env]['database']}, "ruby", "-e p ENV['rubyguides']")

Vector Tiles in Mapbox GL

Adding ESRI Vector Tiles to Mapbox GL JS by Jonah Adkins

Here we can see that adding an Esri vector tile service is a bit different from adding Mapbox tiles. For the Esri tiles, we’re referencing the pbf with the appropriate tiling scheme (z/x/y) using the tiles property instead of url property. To pull in each road type from Esri, I downloaded the style json and looked for references to road layers.

Appending resources/styles/root.json?f=pjson to the end of the service URL gives you the full style with layer names and such

https://tiles.arcgis.com/tiles/41TSzUbTxELRIXMD/arcgis/rest/services/2cool2school/VectorTileServer/tile/{z}/{y}/{x}.pbf