Skip to content

Instantly share code, notes, and snippets.

<%- Page.find(:all, :order => 'number').each do |page|
comment = Comment.find_by_page_id_and_annual_update_id(page.id, @annual_update.id) -%>
Page Name: <%= page.label %>
<%= comment.comment %>
<%- end -%>
<%- @annual_update.comments.find(:all, :order => 'pages.number', :include => :page).each do |c| -%>
<%= c.page.label %>:
<%= c.comment %>
<%- end -%>
apps = {'gmx' => {:workers => 1, :env => 'production'},
'jtrk' => {:workers => 1, :env => 'development'},
'files.colortone' => {:workers => 1, :env => 'development'},
'culture' => {:workers => 1, :env => 'production'},
'uploadjobfiles' => {:workers => 1, :env => 'development'}}
apps.each do |app, params|
rails_root = "/var/www/#{app}/current"
params[:workers].times do |num|
God.watch do |w|
w.name = "dj-#{app}-#{num}"
# above your test
require 'mocha'
# in your test
response = mock
response.stubs(:success?).returns(true)
response.stubs(:authorization).returns(true)
response.stubs(:params).returns({})
ActiveMerchant::Billing::AuthorizeNetGateway.any_instance.stubs(:purchase).returns(response)
private function showDetail(e:Event) {
var res:XMLList
if (e.target.toString().indexOf("List") >= 0) {
var lbl:String;
var xpath:String;
var q:XPathQuery = new XPathQuery(xpath);
lbl = mcResults.lstResults.itemToLabel(e.target.selectedItem);
xpath = "//supplier[name = '" + lbl + "']";
res = q.exec(xmlContent)[0];
} else {
function loadPrintable(e:Event)
{
trace(detail.mcProducts.supplierId.text);
var url:String = xmlContent.appSettings.setting.(@name == "printableStockingList") + "?id=" + detail.mcProducts.supplierId.text ;
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, '_blank'); // second argument is target
} catch (e:Error) {
trace("Error occurred!");
}
<?php
$file = "/var/www/vhosts/cltv8.com/httpdocs/integrawebdemo/video/IntegraWeb_Tour.wmv";
if (!file_exists($file)) trigger_error("File '$file' doesn't exist.", E_USER_ERROR);
header("Content-type: application/octet-stream");
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header("Content-Length: ". filesize($file));
readfile($file);
LocalJumpError in Manage#index
Showing /Users/josh/htdocs/mt/app/views/layouts/application.html.erb where line #71 raised:
no block given
Extracted source (around line #71):
68: <div class="flash warning" id="flash_warning"><%= flash[:warning].html_safe %></div>
69: <% end %>
rails test_app
cd test_app
rails g scaffold person
rails plugin install git://github.com/radar/nested-layouts.git
# application.html.erb
<!DOCTYPE html>
<html>
<head>
TypeError in People#index
Showing /Users/josh/htdocs/test2/app/views/layouts/people.html.erb where line #1 raised:
can't dup Symbol
Extracted source (around line #1):
1: <% inside_layout 'application' do -%>
2: inside