Skip to content

Instantly share code, notes, and snippets.

View nathanKramer's full-sized avatar

Nathan Kramer nathanKramer

View GitHub Profile
@nathanKramer
nathanKramer / README.md
Created September 26, 2019 00:14
How to configure `create-react-app` `PUBLIC_URL` for use in a re-usable slug / container

Usage:

PUBLIC_URL={{DYNAMIC_PUBLIC_URL}}
DYANMIC_PUBLIC_URL=https://my-environment-specific-public-url.com
  • PUBLIC_URL is used at build time by CRA. index.html will contain the literal string {{DYNAMIC_PUBLIC_URL}}
  • DYNAMIC_PUBLIC_URL is used at startup time to perform a find and replace on the string {{DYNAMIC_PUBLIC_URL}}, wherever it is found in index.html
@nathanKramer
nathanKramer / twitter-list-management.py
Last active January 13, 2023 00:00
Create a twitter list containing your followers or your mutuals, with idempotent `set_list` function
import twitter
api = twitter.Api(consumer_key='consumer_key',
consumer_secret='consumer_secret',
access_token_key='access_token_key',
access_token_secret='access_token_secret')
u = api.VerifyCredentials()
def create_list(name='Untitled', mode='private'):
@nathanKramer
nathanKramer / sort_tweets_by_reply_ratio.rb
Created June 12, 2019 09:04
Shitty code to sort tweets by reply ratio
require 'twitter'
client = Twitter::REST::Client.new do |config|
config.consumer_key = "your_consumer_key"
config.consumer_secret = "your_consumer_secret"
config.access_token = "your_access_token"
config.access_token_secret = "your_access_token_secret"
end
def collect_with_max_id(collection = [], max_id = nil, &block)
response = yield(max_id)
@nathanKramer
nathanKramer / pi_million.js
Last active September 8, 2018 09:21
const PI_DIGITS = '.... (1million digits of pi)'
This file has been truncated, but you can view the full file.