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
| andy@hiro:...merb/merb-more% cat merb-gen/lib/generators/templates/application/common/dothtaccess sprint | |
| # Sets the default handler for FastCGI scripts | |
| AddHandler fastcgi-script .fcgi | |
| # If Apache2 is used together with mod_fcgid, | |
| # uncomment the line below and comment in the line | |
| # above to set the correct script handler | |
| #AddHandler fcgid-script .fcgi | |
| RewriteEngine On |
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
| Merb::Router.prepare do | |
| # I don't like the name :condition for this | |
| resources :users, :condition => /.*/ do | |
| resources :comments | |
| end | |
| # match("/users/:id", :id => /.*/) | |
| # match("/users/:user_id/comments", :user_id => /.*/) | |
| end |
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
| def published=(binary_string) | |
| # We need this because the values get populated from the params | |
| attribute_set(:published, binary_string == "1") | |
| end |
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 the article view | |
| <%= render_plugin_views @articles.nil? ? "after_article" : "after_article_in_list", :with => article %> | |
| # in the plugin init | |
| Hooks::View.register_partial_view "after_article", "comments" | |
| # in lib/hooks/view.rb | |
| # This returns an array of the available view hooks | |
| def available_hooks | |
| ["first_article_in_list", "last_article_in_list", "before_article", "before_article_in_list", "after_article", "after_article_in_list", "article_form_fields", "between_articles", "meta_section", "head", "header", "before_layout", "after_layout", "sidebar", "footer"] |
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
| # Event hooks for plugins | |
| before :create, :fire_before_create_event | |
| before :update, :fire_before_update_event | |
| before :save, :fire_before_save_event | |
| after :create, :fire_after_create_event | |
| after :update, :fire_after_update_event | |
| after :save, :fire_after_save_event |
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
| From 49f2caef59e5c915d3fa12b3460b997878ee5b80 Mon Sep 17 00:00:00 2001 | |
| From: Andy Delcambre <[email protected]> | |
| Date: Mon, 8 Sep 2008 15:30:36 -0700 | |
| Subject: [PATCH] typo in error state for create | |
| --- | |
| salesforce/lib/dm-salesforce.rb | 2 +- | |
| 1 files changed, 1 insertions(+), 1 deletions(-) | |
| diff --git a/salesforce/lib/dm-salesforce.rb b/salesforce/lib/dm-salesforce.rb |
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
| class BlahImporter | |
| def self.import | |
| soap = SOAP::WSDLDriverFactory.new(BLAH_WSDL_URL).create_rpc_driver | |
| params = { | |
| 'param1' => "asdf", | |
| 'param2' => 123 | |
| } | |
| res = soap.getSomethings(params) |
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
| irb(main):001:0> require 'rubygems' | |
| => true | |
| irb(main):002:0> require 'redcloth' | |
| => true | |
| irb(main):005:0> a = RedCloth.new "_italic_ <pre><code>var a = 'blah';</code></pre> *bold*" | |
| => "_italic_ <pre><code>var a = 'blah';</code></pre> *bold*" | |
| irb(main):006:0> a.to_html | |
| => "<p><em>italic</em> <pre><code>var a = 'blah';</code></pre> <strong>bold</strong></p>" |
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
| $(document).ready(function() { | |
| $(".photo").each(function(i, e) { | |
| $zoom_id = i + '_zoom'; | |
| $show_link = $('<a class="jquery_link">Toggle Photo</a>'); | |
| $show_link.click(function () { $(this).siblings('img').toggle() }); | |
| $(this).append($show_link); | |
| if (($original = $(this).find(".original")).size() > 0) { | |
| $zoom_link = $('<a class="jquery_link">Zoom</a>'); | |
| $zoom_div = $('<div class="zoom"><img class="dialog_img" src="' + $original.attr("href") + '"/></div>'); |
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
| def get_archive_hash | |
| counts = repository.adapter.query("SELECT COUNT(*) as count, #{specific_date_function} FROM articles WHERE published_at IS NOT NULL AND published = ? GROUP BY year, month ORDER BY year DESC, month DESC", true) | |
| archives = counts.map do |entry| | |
| { | |
| :name => "#{Date::MONTHNAMES[entry.month.to_i]} #{entry.year}", | |
| :month => entry.month.to_i, | |
| :year => entry.year.to_i, | |
| :article_count => entry.count | |
| } | |
| end |