My Recent Pastes (349 and counting)

Pastes by anathematic (349 and counting)

Pages:

Below are the 15 most recent pasties by anathematic.

February 23, 2009
3:01PM EDT
by anathematic

## Ruby extract
<p>
<%= text_field_with_auto_complete :po, :job_string, { :size => 100 }, { :url => formatted_find_jobs_jobs_path(:js), :method => :get, :with => "'search=' + element.value" } %>
</p>

February 22, 2009
5:50PM EDT
by anathematic

## Correct select query which works fine
select jobbook_indices.id from jobbook_indices left join invoices on jobbook_indices.id = invoices.jobbook_index_id where invoices is null

## Problem: Want to insert into invoices table (with invoices.jobbook_index_id preset to missing join id)

February 22, 2009
5:25PM EDT
by anathematic

select jobbook_indices.id from jobbook_indices left join invoices on jobbook_indices.id = invoices.jobbook_index_id where invoices is null

February 20, 2009
7:01PM EDT
by anathematic

## Somehow installed two versions of rubygems, how do I remove 1.9? (I'm assuming it's reference to Ruby1.9)

dataseed@dataseed:/usr/bin$ gem
The program 'gem' can be found in the following packages:
 * rubygems1.8

February 20, 2009
1:35AM EDT
by anathematic

sudo apt-get update
Ign http://security.ubuntu.com feisty-security Release.gpg                                                                                                  
Ign http://security.ubuntu.com feisty-security/main Translation-en_AU                                                                                       
Ign http://security.ubuntu.com feisty-security/restricted Translation-en_AU
Ign http://ppa.launchpad.net hardy Release.gpg                      

February 20, 2009
1:13AM EDT
by anathematic

dataseed@dataseed:~/data_seed$ sudo apt-get install apache2-prefork-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:

February 19, 2009
7:44PM EDT
by anathematic

module MyCompany
 class Document < Prawn::Document
   def company_header
       test "huerr"
   end

February 18, 2009
9:28PM EDT
by anathematic

## Gmail
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
 :address => "smtp.gmail.com",
 :port => 587,

February 18, 2009
9:23PM EDT
by anathematic

## Validation Messages
>> p = Product.new(:name => "hurrr", :price => 0)
=> #<Product id: nil, name: "hurrr", description: nil, price: #<BigDecimal:1f1f954,'0.0',4(8)>, created_at: nil, updated_at: nil, permalink: nil, hot_product: nil>
>> p.save
=> false

February 18, 2009
9:17PM EDT
by anathematic

>> p = Product.new(:name => "hurrr", :price => 0)
=> #<Product id: nil, name: "hurrr", description: nil, price: #<BigDecimal:1f1f954,'0.0',4(8)>, created_at: nil, updated_at: nil, permalink: nil, hot_product: nil>
>> p.save
=> false
>> p.errors.full_messages

February 18, 2009
7:11PM EDT
by anathematic

## Postgresql on rails 
test:
  adapter: postgresql
  encoding: unicode
  database: test_test

February 11, 2009
3:55PM EDT
by anathematic

## WOO PASTIE WORKS!
/me takes pants off

January 20, 2009
8:08PM EDT
by anathematic

## Problem using private methods in callbacks, help?
## Poor method: just an example..
class Fruid < ActiveRecord::Base

  def before_save

January 20, 2009
7:21PM EDT
by anathematic

  attr_accessor :job_string
  # Job string is added for auto-complete handling of jobs in service reports, purchase orders and other child tables of the JobbookIndex model.
  # job_string is validated in a callback (before_save) to find if it reflects a correct job number (as well as if the user is an admin or not)
  # job_string is also reflected as a virtual attribute in JobbookIndex model for user friendly opening of past service reports.
  

January 08, 2009
6:46PM EDT
by anathematic

## Example Email for Remear
  def contact_site(contact, settings)
    recipients settings.user.email
    from contact.fetch(:email)
    subject "[Website] Contact Email"

Next page

Previous page