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
task :create_epubs => [:environment] do | |
av = ActionView::Base.new(Rails.root.join('app', 'views')) | |
av.view_paths = ActionController::Base.view_paths | |
av.extend ApplicationHelper #or any other helpers your template may need | |
@book = Book.first | |
puts @book.to_yaml # this can read from the model | |
body = av.render(:template => "books/epub-show", :locals => @book) # this isn't passing @book to the view correctly, i get undefined method for nil:nilClass | |
end |
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
task :create_epubs => :environment do | |
include Rails.application.routes.url_helpers # brings ActionDispatch::Routing::UrlFor | |
include ActionView::Helpers::TagHelper | |
av = ActionView::Base.new(Rails.root.join('app', 'views')) | |
puts av.render("books/", :books => Book.all).to_string | |
end |
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
book_chapters GET /books/:book_id/chapters(.:format) {:action=>"index", :controller=>"chapters"} | |
POST /books/:book_id/chapters(.:format) {:action=>"create", :controller=>"chapters"} | |
new_book_chapter GET /books/:book_id/chapters/new(.:format) {:action=>"new", :controller=>"chapters"} | |
edit_chapter GET /chapters/:id/edit(.:format) {:action=>"edit", :controller=>"chapters"} | |
chapter GET /chapters/:id(.:format) {:action=>"show", :controller=>"chapters"} | |
PUT /chapters/:id(.:format) {:action=>"update", :controller=>"chapters"} | |
DELETE /chapters/:id(.:format) {:action=>"destroy", :controller=>"chapters"} | |
books GET /books(.:format) {:action=>"index", :controller=>"books"} | |
POST /books(.:format) |
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
class ChaptersController < ApplicationController | |
before_filter :check_ownership_of_chapters_book | |
def check_ownership_of_chapters_book | |
#abort(params.to_yaml) | |
=begin | |
--- | |
utf8: ✓ | |
authenticity_token: NwsHY5ex9ynzXfDSXiQ8EBps6Yhzxf0iPPbJPWLkTtg= |
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
Bundler could not find compatible versions for gem "rails": | |
In Gemfile: | |
rails_admin depends on | |
rails (~> 3.1) | |
rails (3.1.0.rc5) |
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
XDocument doc = XDocument.Load(s); | |
flicks.Clear(); | |
XNamespace serv = "http://search.yahoo.com/mrss/"; | |
foreach (XElement value in doc.Element("rss").Element("channel").Elements("item")) | |
{ | |
flick _item = new flick(); |
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
ExtendedImage _img = sender as ExtendedImage; | |
byte transpCorner = _img.Pixels[0 * _img.PixelWidth + 0]; // top left pixel | |
byte[] newPixels = _img.Pixels; | |
for (int xp = 0; xp < _img.PixelWidth; xp++) | |
{ | |
for (int yp = 0; yp < _img.PixelHeight; yp++) | |
{ | |
int r = 0, g = 0, b = 0, alpha = 0; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
<!--[if IE]> | |
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> | |
<style> | |
article, aside, figure, footer, header, hgroup, |
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
checking for IceConnectionNumber in -lICE... yes | |
------------------------------------------------------------- | |
checking for X11... | |
checking for shmctl... yes | |
checking for XShmAttach in -lXext... yes | |
checking for XShapeCombineMask in -lXext... yes | |
checking for XtSetEventDispatcher in -lXt... yes | |
------------------------------------------------------------- | |
checking for ZLIB... | |
checking zconf.h usability... yes |