Instantly share code, notes, and snippets.

@note103 /sb-post.rb Secret
Last active Sep 13, 2018

Embed
What would you like to do?
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'uri'
require 'date'
prj = ARGV[0]
msg = ARGV[1]
exit if ARGV.length == 0
msg = msg.gsub(/ /, ' ')
msg = URI.encode(msg)
d = Date.today.to_s
url = 'https://scrapbox.io/' + prj + '/' + d + '?body=' + msg
url.gsub!(/\(/, '\(')
url.gsub!(/\)/, '\)')
url.gsub!(/\</, '\<')
url.gsub!(/\>/, '\>')
url.gsub!(/\&/, '%26')
system("open " + url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment