Skip to content

Instantly share code, notes, and snippets.

@czj
Created August 4, 2018 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save czj/5582dfc51ec86c70402ca5a0470af2b3 to your computer and use it in GitHub Desktop.
Save czj/5582dfc51ec86c70402ca5a0470af2b3 to your computer and use it in GitHub Desktop.
Work log output to local file + to Slack
#!/usr/bin/env ruby
require "bundler/inline"
gemfile { gem "slack-notifier" }
require "slack-notifier"
Slack::Notifier.new("https://hooks.slack.com/services/xxxxxxx").ping("• _#{query}_")
logs_dir = "~/Documents/work_logs"
query = ARGV[0].to_s.delete('\\')
logfile = "#{logs_dir}/#{Time.now.strftime('%Y-%m-%d')}.txt"
open(logfile, "a") { |f| f.puts query }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment