This file contains hidden or 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
while :; do socat UNIX:$SSH_AUTH_SOCK EXEC:"lxc-attach -n $CONTAINER_NAME -- /usr/bin/socat STDIN UNIX-LISTEN\:/agent-sock"; done | |
# After entering the container the usual way using lxc-attach (from a separate host shell), set the SSH_AUTH_SOCK environment variable to "/agent-sock". | |
# Needs socat both on the host and in the container. |
This file contains hidden or 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
// Install the "Groovy Postbuild" plugin and use this as postbuild script: | |
def message = "${manager.build.result}" + ': ' + manager.build.getDisplayName() + ' ' + manager.build.getAbsoluteUrl() | |
def command = ['sh', '-c', 'echo "' + message + '" | curl --data-binary @- "https://YOURSLACKDOMAIN/services/hooks/slackbot?token=YOUR_SLACKBOT_INTEFGRATION_TOKEN&channel=URL_ENCODED_CHANNEL_NAME"' ] | |
command.execute() |
This file contains hidden or 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
config.before(:each) do | |
if self.class.metadata[:type] == :view | |
view.singleton_class.send :alias_method, :original_image_tag, :image_tag | |
view.singleton_class.send :define_method, :image_tag do |path, options = {}| | |
normalized_path = path_to_image(path.to_s) | |
asset_paths = Sprockets::Helpers::RailsHelper::AssetPaths.new(nil) # hack: easy access to is_uri? | |
unless asset_paths.is_uri?(normalized_path) | |
normalized_path = normalized_path[asset_prefix.length+1..-1] | |
unless Rails.application.assets.find_asset(normalized_path) or path.respond_to?(:stubbed?) |
This file contains hidden or 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
# Sometimes Constraints need to interact with controllers (fex. in order not to query the database twice), then I like | |
# to put them inside the controller. If you load controllers from your routes.rb (more precisely, when routes.rb is loaded), | |
# these won't reload in development mode. | |
# If your constraints live somewhere else (say, /app/constraints), it's basically all the same. | |
# This demonstrates an easy workaround by wrapping the fetching of constraints in a block: | |
class ConstraintWrapper | |
# Helps to load constraints from inside controllers without breaking | |
# development environment reloading |
This file contains hidden or 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
# in m/m_q.rb | |
module M | |
module MQ | |
end | |
end | |
# in m/m2.rb | |
module M |
This file contains hidden or 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
Note: the full file names are config/backup/Gemfile and config/deploy.rb, which gist.github.com can't handle ;-) | |
Of course, you will need a backup config file, preferrably in config/backup/config.rb, and you need to trigger the backup from cron (check out the whenever gem if you want that behaviour bundled with your rails app). | |
In both files, you need to take the locations of stuff (rails root, backup config file) into consideration. |
This file contains hidden or 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
module A | |
module B | |
end | |
module Wrapper | |
module C | |
end | |
end | |
#Cite: | |
#When this module is included in another, Ruby calls append_features in this |
NewerOlder