Skip to content

Instantly share code, notes, and snippets.

View patmaddox's full-sized avatar
🤔
Trying to figure out how to look up comments I've left

Pat Maddox patmaddox

🤔
Trying to figure out how to look up comments I've left
View GitHub Profile
@patmaddox
patmaddox / drip_exp_id.rb
Last active July 11, 2017 05:32
Ruby script to generate random experiment id for email list CSV files
# Generate a random experiment id for existing drip subscribers
# Import the generated output.csv file back into drip...
# Use at your own risk (but it worked for me :)
require 'csv'
input_file = ARGV[0]
column_name = ARGV[1]
max_value = ARGV[2].to_i
@patmaddox
patmaddox / config.ru
Created January 22, 2016 21:05
Rack::Cors no worky
require "jekyll-auth"
require "rack/cors"
run JekyllAuth.site
use Rack::Cors do
allow do
origins '*'
resource '*', headers: :any, methods: [:get, :options, :head]
end
@patmaddox
patmaddox / z.applescript
Created December 23, 2015 23:18
zettlel scripts
tell application "nvALT"
activate
set title to "{query}"
set zzid to do shell script "source ~/.bash_profile && make_zzid"
set zettle_title to zzid & " " & title
search zettle_title
tell application "System Events"
key code 52 -- Return, create note
keystroke zettle_title
@patmaddox
patmaddox / pinboard_support_email.md
Created December 5, 2015 21:23
pinboard support email about rss feeds and full-text search

Hi there,

What's the best way to get articles from RSS feeds into pinboard? Do you know of an RSS reader service that will automatically and reliably post new articles to pinboard?

Also, my account page says that my articles have been archived. But full-text search doesn't seem to be happening. Do I just need to be more patient for the first pass at indexing?

<3 Pat

@patmaddox
patmaddox / 1_schedule.rb
Created December 5, 2015 17:20
scheduling auto-tweets for t
#!/usr/bin/env ruby
require 'chronic'
time = Chronic.parse ARGV[0]
message = ARGV[1]
File.open("#{time.to_i}_scheduled_tweet", 'w') do |file|
file << message
end
@patmaddox
patmaddox / read_later_requirements.md
Last active December 3, 2015 18:14
read later feature requirements
  1. RSS feed of articles, with article full-text, and RSS item linking to original article URL
  2. Easy to add links (emailing a link would be nice, for example)

I know about

  • Instapaper - looks promising. Free account only shows a ~40-word preview in RSS. Premium says it offers full-text search - but I don't know if the RSS feed includes the full article as well.
  • Pocket
  • Feedly
  • Inoreader
  • Readability
@patmaddox
patmaddox / convert_18_hashes_to_19.sh
Created September 7, 2015 15:53
convert ruby 1.8 hashes to 1.9 (via @askl56)
find . -name \*.rb -exec perl -p -i -e 's/([^:]):(\w+)\s*=>/\1\2:/g' {} \;
@patmaddox
patmaddox / exercise_1_intent.rb
Created July 29, 2015 03:28
Refactoring with simple rules
class Foo
def something(bar)
bar.do_something
end
end
class Account
def initialize
@balance = "0"
end
@patmaddox
patmaddox / exercise_1a_self.rb
Created July 29, 2015 03:23
Messaging - the big idea
class Foo
def foo
puts "I am foo!"
end
def do_foo
# all five are equivalent
foo
self.foo
foo()
require 'minitest/autorun'
class ArrayTest < MiniTest::Test
def test_new_array_has_zero_size
assert(Array.new.size == 0)
end
def test_new_array_is_empty
assert(Array.new.empty?)
end