Skip to content

Instantly share code, notes, and snippets.

View jimmybaker's full-sized avatar

Jimmy Baker jimmybaker

View GitHub Profile
desc "Fetch affiliate offers"
task :getoffers => :environment do
require 'mechanize'
agent = WWW::Mechanize.new
agent.get("http://odigger.com/Find-All-Affiliate-Programs")
total_number_of_pages = ..gram the total number of pages..
total_number_of_pages.to_i.times do |page_num|
agent.get("http://odigger.com/Find-All-Affiliate-Programs?&pg=#{page_num + 1}")
desc "Fetch affiliate offers"
task :getoffers => :environment do
require 'nokogiri'
require 'open-uri'
Offer.find(:all).each do |offer|
url = "http://www.findaffiliateoffers.com/index.php?function=search&search="
doc = Nokogiri::HTML(open(url))
payout = doc.at_css(".l4").text[/[0-9\.]+/]
offer.update_attribute(:payout, payout)
class Person
attr_accessor :first_name, :last_name, :email, :phone_number, :sexual_preference
def protected_columns
[:phone_number, :sexual_preference]
end
end
- title "Registration for #{@training_event.name}"
- content_for :main do
%h1== Registration for #{@training_event.name}
- form_for @trainee, :url => register_training_event_path(@training_event) do |f|
%h2 Personal Information
%p
= f.label :first_name
%br= f.text_field :first_name
Titanium.UI.setBackgroundColor('#fff');
var token = Titanium.App.Properties.getString('token');
if(token == null) {
// show sign up screen
var win = Titanium.UI.createWindow({
url: 'main_windows/auth/choose.js',
backgroundColor: '#fff',
tabBarHidden:true,
navBarHidden:true
var token = Titanium.App.Properties.getString('token');
if(token == null) {
// show sign up screen
var win = Titanium.UI.createWindow({
url: 'main_windows/auth/choose.js',
backgroundColor: '#fff'
});
win.open({
delay: 1000,
require 'rubygems'
source 'http://gemcutter.org'
gem 'rails', '3.0.0.beta3'
gem 'haml'
gem 'bitly'
gem 'twitter_oauth'
gem 'sanitize'
gem 'devise', '1.1.rc1'
module Paperclip
class Download < Processor
attr_accessor :file, :options, :attachment
def initialize(file, options={}, attachment=nil)
super
@file = file
@options = options
@attachment = attachment
require 'fileutils'
module Paperclip
class AudioClip < Processor
attr_accessor :whiny, :start_time, :duration
def initialize(file, options={}, attachment=nil)
super
@file = file
@whiny = options[:whiny].nil? ? true : options[:whiny]
require 'fileutils'
module Paperclip
class AudioClip < Processor
attr_accessor :whiny, :start_time, :duration
def initialize(file, options={}, attachment=nil)
super
@whiny = options[:whiny].nil? ? true : options[:whiny]
@basename = File.basename(file.path, File.extname(file.path))