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.
const PI_DIGITS = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380