This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
attr_accessor :first_name, :last_name, :email, :phone_number, :sexual_preference | |
def protected_columns | |
[:phone_number, :sexual_preference] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Paperclip | |
class Download < Processor | |
attr_accessor :file, :options, :attachment | |
def initialize(file, options={}, attachment=nil) | |
super | |
@file = file | |
@options = options | |
@attachment = attachment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |