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
| {# ================================================================== #} | |
| {# Responsive Image Macro | |
| {# ================================================================== #} | |
| {# | |
| Macro to centralize the markup and config for responsive images. | |
| Based on an article by Marion Newlevant (@marionnewlevant) and | |
| adapted for the Lazysizes plugin. Read more: | |
| https://straightupcraft.com/articles/responsive-images-with-twig-macros |
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
| <?php | |
| namespace Craft; | |
| // This file could be placed into your public_html folder and visited to import a cheese product. | |
| $craft = require '../craft/app/bootstrap.php'; | |
| $craft->plugins->loadPlugins(); | |
| $newProduct = new Commerce_ProductModel(); |
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
| <?php | |
| namespace Craft; | |
| class SlugifyPlugin extends BasePlugin | |
| { | |
| public function getName() | |
| { | |
| return Craft::t('Slugify Twig Extension'); | |
| } | |
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
| [{ | |
| "title":"Post 1", | |
| "body":"Body goes here.", | |
| "tags":["Tag 1", "Tag 2"], | |
| "slug":"post-1", | |
| "published_at":"2013-06-05T18:24:59-04:00" | |
| }, { | |
| "title":"Post 2", | |
| "body":"Body goes here.", | |
| "tags":["Tag 1", "Tag 2"], |
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
| # my app had quite a few different worker classes so | |
| # i decided to extend them all from one place: | |
| # config/initializers/resque.rb | |
| if Rails.env == "production" || Rails.env == "staging" | |
| resque_klasses = [ | |
| SomeJob, | |
| AnotherJob, | |
| VeryHardWork, | |
| PrettyEasyJobHere |
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
| require 'simple_worker' | |
| require 'mongoid' | |
| class ExampleWorker < SimpleWorker::Base | |
| #Not sure if this is necessary (according to the docs), but | |
| #it stopped complaining when I did it. | |
| merge File.join(File.dirname("__FILE__"), "..", "models", "user.rb") | |
| attr_accessor :user_id, :mongodb_settings |
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
| ENV["RAILS_ENV"] ||= "test" | |
| require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') | |
| require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support | |
| require 'cucumber/rails/rspec' | |
| require 'cucumber/rails/world' | |
| require 'cucumber/web/tableish' | |
| require 'capybara/rails' | |
| require 'capybara/cucumber' |
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 PagesController < ApplicationController | |
| before_filter :login_required, :except => [ :show ] | |
| # GET /pages | |
| # GET /pages.xml | |
| def index | |
| @pages = Page.find(:all) | |
| respond_to do |format| | |
| format.html # index.html.erb |