Skip to content

Instantly share code, notes, and snippets.

@osak
Created August 24, 2011 17:24
Show Gist options
  • Select an option

  • Save osak/1168605 to your computer and use it in GitHub Desktop.

Select an option

Save osak/1168605 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
miquire :plugin, 'plugin'
miquire :addon, 'addon'
miquire :core, 'environment'
#miquire :core, 'utils'
miquire :core, 'post'
require 'fileutils'
#
# mikutterが落ちたとき自動でpostします.
#
module MikutterxOchitter
def self.mikutterxochitter
Post.services.first.post(:message => '【速報】mikutterおちた at ' + Time.now.to_s).join(3)
end
Signal.trap(:SEGV) do
mikutterxochitter
abort
end
=begin
args = {
:slug => :teokure,
:name => 'ておくれ',
:condition => lambda { |m| true },
:description => 'ておくれさせる',
:exec => lambda { |postbox| puts "teokure"; raise },
:visible => true,
:role => :message,
}
Plugin.create(:contextmenu).add_event_filter(:command) { |menu|
menu[args[:slug]] = args
[menu]
}
=end
end
alias org_file_put_contents file_put_contents
def file_put_contents(fn, body)
if fn == File.join(File.expand_path(Environment::TMPDIR), 'crashed_file')
MikutterxOchitter.mikutterxochitter
end
org_file_put_contents(fn, body)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment