My Recent Pastes (95 and counting)

Pastes by brough (95 and counting)

Pages:

Below are the 15 most recent pasties by brough.

August 27, 2007
6:27PM EDT
by brough

class CreateMailrTables < ActiveRecord::Migration

  def self.up

    create_table :users do |t|

August 26, 2007
10:58AM EDT
by brough

  City Load (2.637009)   SELECT *, (ACOS(COS(-0.399680398706701)*COS(-0.754564012697105)*COS(RADIANS(cities.lat))*COS(RADIANS(cities.lng))+
 COS(-0.399680398706701)*SIN(-0.754564012697105)*COS(RADIANS(cities.lat))*SIN(RADIANS(cities.lng))+
 SIN(-0.399680398706701)*SIN(RADIANS(cities.lat)))*3963.19)
 AS distance FROM cities WHERE (cities.lat>-30.1284926426796 AND cities.lat<-15.6715073573204 AND cities.lng>-51.0728873255754 AND cities.lng<-35.3937792744246 AND (ACOS(COS(-0.399680398706701)*COS(-0.754564012697105)*COS(RADIANS(cities.lat))*COS(RADIANS(cities.lng))+
 COS(-0.399680398706701)*SIN(-0.754564012697105)*COS(RADIANS(cities.lat))*SIN(RADIANS(cities.lng))+

August 23, 2007
10:44PM EDT
by brough

                $$(.ajaxme).each(function(element){
                   element.addEvent('click', function(el) {
                        new Event(el).stop();
                        var url = el.getProperty('href')
                        var target = $(el.getProperty('rel'))

August 23, 2007
9:47PM EDT
by brough

# <h1>Find an Expert</h1>
# <div id="category_select">
# <%= label('business_category','Main Category')%><br>
# <%= collection_select(:business, :category_id, @cats, :id, :title, {:prompt => 'Select a parent category...'}) %><br><br>
#

August 23, 2007
9:14PM EDT
by brough

window.addEvent('domready', function(){            

   $('business_category_id').addEvent('change', function(){
        var action = "/find/show_subcategories"     
        var target = $('select2')

August 23, 2007
3:34PM EDT
by brough

function getcount(){

       $$('map area').each(function(el){
         new Tip(el, el.alt);
         var count = el.readAttribute('alt')

August 22, 2007
9:35AM EDT
by brough

Event.observe(window, 'load', function() {
       $$('map area').each(function(el){
         var count = el.getProperty('alt')
       Event.observe(el, 'mouseover', function(){
         $('countbox').empty().innerHTML(count)

August 21, 2007
11:04PM EDT
by brough

this ungodly mess returns:

city,city_ascii,lat,lng,country_id,region_id 

It's a one-off query, I need to generate csv file for 2.5 million records so I can import into the db with foreign keys.

August 15, 2007
11:09PM EDT
by brough

class AssetsController < ApplicationController

layout proc{ |c| c.request.xhr? ? false : "assets" }  

# ^ loose layout if page is requested using Ajax. 

August 14, 2007
10:16PM EDT
by brough

class Buyer < ActiveRecord::Base
  has_many :leads
  has_many :zips, :through => :leads

class Zip < ActiveRecord::Base

August 13, 2007
12:47AM EDT
by brough

  def events
    now = Time.now
    nextweek = 1.week.from_now
    secondweek = 2.weeks.from_now
    nextmonth = 4.weeks.from_now

August 10, 2007
6:47AM EDT
by brough


def send_question
  gnupg = GnuPG.new :recipient=>"email@hotel.com"
  gnupg.load_public_key File.read("/path/to/public/key.asc")

August 06, 2007
7:52PM EDT
by brough

adds ajax to all forms on a page within a div with 'jaxy' class name.

Form class name is the update target.

window.addEvent('domready', function(){

August 05, 2007
10:46AM EDT
by brough

helper:

  def tab(this)
    if this == @tab
      "hot"

August 05, 2007
4:56AM EDT
by brough

error: "element.getProperty('action')" is not a function....

window.addEvent('domready', function(){
        var destroy = $$('#homeSpecs form');
        destroy.each(function(element){

Next page

Previous page