Skip to content

Instantly share code, notes, and snippets.

Avatar

Todd Wolfson twolfson

View GitHub Profile
@twolfson
twolfson / README.md
Created Dec 19, 2018
Foursquare backup notes
View README.md

This is a personal log of getting a Foursquare backup/export setup. It's intended to be a bit of a resource for those who are bridging between technical and non-technical

It's not super explanatory either though. If you do have issues, feel free to email me and I'll update it in fuller detail =)


We want to export our Foursquare data and make the switch to Yelp in 2019 We have lost faith in Foursquare being maintained on Android and thus discovery can only be done on Yelp As a result, we might as well consolidate the data

@twolfson
twolfson / .gitignore
Created Dec 19, 2018 — forked from tmcw/foursquare_archive.py
Simple Foursquare Checkins Archive of one User
View .gitignore
checkins/
venuehistory/
venuelikes/
@twolfson
twolfson / README.md
Created Jun 12, 2018
Rails generator locations
View README.md

lib/templates

We've had trouble finding our paths for templates before. Here's a good StackOverflow on the topic:

https://stackoverflow.com/a/37701125

To use this in practice, edit vendor/bundle/ruby/2.4.0/gems/thor-0.20.0/lib/thor/actions.rb to dump source_paths and file:

Example for table migration:

@twolfson
twolfson / concerns-keyed_model.rb
Created Jun 12, 2018
Rails acts-as-keyed updated/simplified
View concerns-keyed_model.rb
# Largely based on `acts-as-keyed` but with less magic (namely make `to_param` consistent, don't overwrite `find`)
# https://github.com/jhubert/acts-as-keyed
# http://vaidehijoshi.github.io/blog/2015/10/13/stop-worrying-and-start-being-concerned-activesupport-concerns/
module KeyedModel
extend ActiveSupport::Concern
KEY_CREATION_RETRIES = 100
KEY_LENGTH = 8
included do
@twolfson
twolfson / main.sh
Created Apr 14, 2018
Unnest folders into 1 flat folder of symlinks
View main.sh
#!/usr/bin/env bash
# Do you have a bunch of nested folders of images that you want to scroll through easily?
# Well this script is for you, it will take nested folders and symlink their files so they're easily scrollable
# It retains the full path so files which should be next to each other still are :+1:
# Exit under sane conditions
set -euo pipefail
# Allow spaces in path names
# https://stackoverflow.com/a/7039579
@twolfson
twolfson / main.sh
Created Apr 13, 2018
Increment README version script
View main.sh
#!/usr/bin/env bash
# Exit on first error, unset variable, or pipe failure
set -euo pipefail
# Define our constants
README_FILEPATH="README.md"
# Resolve our version being deployed
# **1.0.0** -> 1.0.0
version="$(grep -E "\*\*\d+\.\d+\.\d+\*\*" "${README_FILEPATH}" | sed "s/\*//g")"
@twolfson
twolfson / main.rb
Last active Mar 16, 2018
Pipe child process stdout and stderr to main process in Ruby
View main.rb
Open3.popen3("./tmp.sh") do |stdin, stdout, stderr, wait_thr|
# Stream output
# DEV: We'd like to stream both `stderr` and `stdout` but it was getting troublesome
# with `.alive?` and `gets()` blocking each other
while line = stdout.gets()
$stdout.puts(line)
end
# Finish any last stderr or stdout
stdout_remainder = stdout.read()
@twolfson
twolfson / main.sh
Last active Mar 22, 2018
Increment CFBundleVersion script, generally reusable for incrementing version in bash
View main.sh
#!/usr/bin/env bash
# Exit on first error, unset variable, or pipe failure
set -euo pipefail
# Define our constants
PLIST_FILEPATH="path/to/plist.plist"
# Resolve our version being deployed
# https://gist.github.com/sekati/3172554
# DEV: `plutil` doesn't support extraction easily (could use `-o -` but it's wrapped in XML/binary/JSON)
@twolfson
twolfson / IconDisabled.png
Created Dec 16, 2017
Proof of concept to demonstrate how `tabs.sendMessage` refuses to send in Firefox's responive design mode
@twolfson
twolfson / IconDisabled.png
Last active Dec 16, 2017
Proof of concept to demonstrate how `runtime.onMessage` is missing tab in Firefox's responive design mode
You can’t perform that action at this time.