Skip to content

Instantly share code, notes, and snippets.

1)
ActionController::RoutingError in 'PostsController with a guest does not allow a post to be disabled'
No route matches {:controller=>"posts", :topic_id=>123, :id=>567, :action=>"deactivate"}
./spec/controllers/posts_controller_spec.rb:146:
2)
ActionController::RoutingError in 'PostsController with an admin user disables a post'
No route matches {:controller=>"posts", :topic_id=>123, :id=>567, :action=>"deactivate"}
./spec/controllers/posts_controller_spec.rb:123:
@twinge
twinge / gist:322298
Created March 5, 2010 00:12 — forked from anonymous/gist:322297
asdf.asp
foreach (var dimType in ViewData.Model.SelectedProduct.DimensionTypes)
{
string ddlName = String.Format("ddlDimension_{0}", dimType.Key);
var dimensions = variations.Select(sv => sv.Dimensions.FirstOrDefault(d => d.TypeKey == dimType.Key));
var valueList = dimensions
.Select(d => new { Key = d.Key, ShortValue = d.ShortValue, IsInStock = variations.Any(sv => sv.Available && sv.Dimensions.Any(sd => sd.Key == d.Key)) })
.Distinct()
.OrderBy(d => DimensionSorter.GetSortOrder(d.Key))
.ToList();
var i = 0;
foreach (var dimType in ViewData.Model.SelectedProduct.DimensionTypes)
{
i++;
string ddlName = String.Format("ddlDimension_{0}", dimType.Key);
var dimensions = variations.Select(sv => sv.Dimensions.FirstOrDefault(d => d.TypeKey == dimType.Key));
var valueList = dimensions
.Select(d => new { Key = d.Key, ShortValue = d.ShortValue, IsInStock = variations.Any(sv => sv.Available && sv.Dimensions.Any(sd => sd.Key == d.Key)) })
.Distinct()
def download_pdf
@pdf = Prawn::Document.new(:template => @format.zip.path)
inspector = PDF::Inspector::Page.analyze(@pdf.render)
@pdf.font 'Helvetica'
@pdf.font_size = 8
1.upto(inspector.pages.size) do |page|
@pdf.go_to_page(page)
@pdf.move_down 750
@pdf.text "Prepared for #{current_user.name}"
end
module Cmt
CONFIG = {
# Allow GCX logins in the form on the CMT login page.
:gcx_direct_logins => true,
# Allow local user logins in the form on the CMT login page.
:local_direct_logins => true,
# Allow GCX logins using the GCX login page (aka the greenscreen).
# This will show a link on the login page. If the direct GCX or
pdf = Prawn::Document.new(:template => @format.zip.path)
inspector = PDF::Inspector::Page.analyze(pdf.render)
pdf.font 'Helvetica'
pdf.font_size = 8
1.upto(inspector.pages.size) do |page|
pdf.go_to_page(page)
pdf.transparent(0.2) do
pdf.fill_color "ff0000"
pdf.draw_text "watermark", :at => [200,420], :size => 32, :rotate => 45
end
<?php
error_reporting(E_NONE);
require_once("SetaPDF_Stamper.php");
define('SetaPDF_STAMPER_FONTPATH', 'font/');
// Create a new instance of SetaPDF_Stamper with output method "Inline"
$stamper =& SetaPDF_Stamper::factory('I');
$fileio = array(
"in" => "/Users/josh/Desktop/week6.pdf",
"out" => "/Users/josh/Desktop/week6-marked.pdf",
## Controller
respond_to do |format|
format.xls do
filename = @search_for.gsub(';',' -') + ".xls"
#this is required if you want this to work with IE
if request.env['HTTP_USER_AGENT'] =~ /msie/i
headers['Pragma'] = 'public'
headers["Content-type"] = "text/plain"
headers['Cache-Control'] = 'no-cache, must-revalidate, post-check=0, pre-check=0'
var img = $(this);
var canvasImg = document.createElement("canvas");
canvasImg.setAttribute("id", 'cx'+img.attr('data-picid'));
canvasImg.setAttribute("title", '');
drawImageOnCanvas(img.attr('src'), canvasImg);
img.parent().append(canvasImg);
var canvasImg2 = document.createElement("canvas");
canvasImg2.setAttribute("id", 'cxs'+img.attr('data-picid'));
<?php
//Show category?
if ($cat_link_string != ''){
$output = '<p><strong>' . $cat_link_string . '</strong></p>';
}else{
$output = '';
}
$output .= '<ul class="lcp_catlist">';//For default ul