This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script surrounds the command passed in with start and finish notifications | |
# to the cronitor monitoring application. | |
# | |
# === SETUP | |
# | |
# * Make sure the cronitor script is executable. | |
# | |
# chmod +x cronitor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Example using both an embedded code block (with language explicitly specified), and inline code. | |
T> When a Ruby object is printed or otherwise asked to represent itself as a | |
string, the `to_s` ('to string') method of that object is called. So for our | |
managed object what we want to do is define a `to_s` method which displays our | |
task attributes. Add this method to `app/task.rb`: | |
T> | |
{lang="ruby"} | |
def to_s | |
"Priority: #{self.priority} " + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in | |
# all copies or substantial portions of the Software. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you use this class instead of SimpleDocTemplate you can add ColorFrame objects along | |
# with regular Frame objects and the ColorFrame objects will have their background colour | |
# rendered at the appropriate time during the document build process. | |
class ColorFrameDocTemplate(SimpleDocTemplate): | |
def handle_frameBegin(self, *args): | |
SimpleDocTemplate.handle_frameBegin(self, *args) | |
if hasattr(self.frame, 'background'): | |
self.frame.drawBackground(self.canv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from optparse import OptionParser | |
parser = OptionParser() | |
parser.add_option("--debug", action="store_true", dest="debug") | |
(options, args) = parser.parse_args() | |
# Access the option like so; in this case it will be stored as a boolean | |
print options.debug |