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
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 |
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
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 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 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 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 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 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 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
Intended at programmers, not absolute beginners. | |
Consume these resources in this order to get the hang of Rust: | |
1) for motivation and the basic resource management notions https://d3fenhwk93s16g.cloudfront.net/0l7u7x/mp4.mp4?t=142109848354b43df3bf31f | |
2) for a tour of the language features and to get a grip on the syntax http://rustbyexample.com/ | |
3) go more into depth http://doc.rust-lang.org/book/ | |
Work in progress. Suggestions welcome! |
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
# jsxlint does not consider files not ending in .jsx as containing JSX syntax. | |
# With react-rails, a .jsx file is not subject to 6to5/babel transformation, | |
# hence I cannot use JSX syntax and ES6 at the same time. | |
# This little hack (and a little convention) does the trick for me: | |
# | |
# The sprockets-es6 gem provides both transformations I want for the .es6 ending. | |
# I name my files ending in .es6.jsx (which happens to be descriptive as well) | |
# and make the .jsx transformation step a NOP (by overwriting the engine | |
# which has been registered for .jsx before by react-rails). |
We can't make this file beautiful and searchable because it's too large.
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
Ort;Zusatz;Plz;Vorwahl;Bundesland | |
Aach;b Trier;54298;0651;Rheinland-Pfalz | |
Aach;, Hegau;78267;07774;Baden-Württemberg | |
Aachen;;52062;0241;Nordrhein-Westfalen | |
Aachen;;52064;0241;Nordrhein-Westfalen | |
Aachen;;52066;0241;Nordrhein-Westfalen | |
Aachen;;52068;0241;Nordrhein-Westfalen | |
Aachen;;52070;0241;Nordrhein-Westfalen | |
Aachen;;52072;0241;Nordrhein-Westfalen | |
Aachen;;52074;0241;Nordrhein-Westfalen |
OlderNewer