Skip to content

Instantly share code, notes, and snippets.

@russ
russ / data.rake
Created September 14, 2013 19:06
namespace :sync do
desc "Backs up heroku database and restores it locally"
task production: :environment do
Bundler.with_clean_env do
system("heroku pgbackups:capture --expire --remote production")
timestamp = Time.now.utc.strftime("%Y%m%d%H%M%S")
system("curl -o ../pgbackups/production_#{timestamp}.dump --create-dirs `heroku pgbackups:url --remote production`")
last_backup = Dir.entries("../pgbackups").last
database = Rails.configuration.database_configuration[Rails.env]['database']
system("pg_restore --verbose --clean --no-acl --no-owner -d #{database} ../pgbackups/#{last_backup}")
require 'lastfm'
API_KEY = 'XXX'
API_SECRET = 'XXX'
lastfm = Lastfm.new(API_KEY, API_SECRET)
# token = lastfm.auth.get_token
token = '435708b60cde32b6df36b8585fe75725'
# open http://www.last.fm/api/auth/?api_key=XXXX&token=token
require 'lastfm'
API_KEY = 'XXX'
API_SECRET = 'XXX'
lastfm = Lastfm.new(API_KEY, API_SECRET)
# token = lastfm.auth.get_token
token = '435708b60cde32b6df36b8585fe75725'
# open http://www.last.fm/api/auth/?api_key=XXXX&token=token
{"details":"Ambiguous oauth credentials provided","problem":"You are not authorized to make that request","code":"ambiguous_credentials"}
module Unform
extend ActiveSupport::Concern
class FormObject
include Virtus
include ActiveModel::Validations
end
included do
@models = {}
module Unform
extend ActiveSupport::Concern
class FormObject
include Virtus
include ActiveModel::Validations
end
included do
@models = {}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<style>
#bg-left-extension {
width: 1000px;
background: blue;
}
</style>
<div id="bg-left-extension" height="100"></div>
class Seller < ActiveRecord::Base
has_one :business
accepts_nested_attributes_for :business
devise :database_authenticatable, :registerable, :token_authenticatable,
:lockable, :timeoutable, :recoverable, :rememberable, :trackable, :validatable
attr_accessible :email, :password, :last_name, :first_name, :remember_me, :business_attributes
class Seller < ActiveRecord::Base
has_one :business
accepts_nested_attributes_for :business
devise :database_authenticatable, :registerable, :token_authenticatable,
:lockable, :timeoutable, :recoverable, :rememberable, :trackable, :validatable
attr_accessible :email, :password, :last_name, :first_name, :remember_me, :business_attributes
#!/usr/bin/env ruby
require 'rubygems'
require 'tweetstream'
hash_tag = '#vegastech'
useage = []
def show_stats(stats)
# Aggregate Results