Skip to content

Instantly share code, notes, and snippets.

@psykidellic
psykidellic / gist:6440552
Created September 4, 2013 18:05
Better way to keep user history?
I have a table where I keep record whenever somebody plays a track:
id, user_id, song_id, created_at
I was hoping to generate user history based on this so I have a query like:
```
select albums.id from albums join songs on albums.id = songs.album_id join
song_played_stats on song_played_stats.song_id = songs.id order by
song_played_stats.created_at desc;
* executing "cd -- /home/ubuntu/beamtous/releases/20130831223444 && bundle exec rake RAILS_ENV=staging RAILS_GROUPS=assets assets:precompile && cp -- /home/ubuntu/beamtous/shared/assets/manifest.yml /home/ubuntu/beamtous/releases/20130831223444/assets_manifest.yml"
servers: ["psykidellic.xen.prgmr.com"]
[psykidellic.xen.prgmr.com] executing command
** [out :: psykidellic.xen.prgmr.com] /home/ubuntu/.rvm/rubies/ruby-1.9.3-p194/bin/ruby /home/ubuntu/beamtous/shared/bundle/ruby/1.9.1/bin/rake requirejs:precompile:all RAILS_ENV=staging RAILS_GROUPS=assets
** [out :: psykidellic.xen.prgmr.com]
** [out :: psykidellic.xen.prgmr.com] AssetSync: using /home/ubuntu/beamtous/releases/20130831223444/config/initializers/asset_sync.rb
** [out :: psykidellic.xen.prgmr.com]
** [out :: psykidellic.xen.prgmr.com] AssetSync: using /home/ubuntu/beamtous/releases/20130831223444/config/initializers/asset_sync.rb
** [out :: psykidellic.xen.prgmr.com]
** [out :: psykidellic.xen.prgmr.com] AssetSync: using /home/ub
[global]
run_time: 300
rampup: 300
results_ts_interval: 20
progress_bar: on
console_logging: off
xml_report: on
[user_group-1]
threads: 10
id: cats-play
album: Cats and Play (form)
label: Trishula Records (form)
artist: Mubali (form)
release: 2006-03-01 (form)
source: custom (form)
genres: forest, psychedelic (form)
path: n/a
description: (form)
url: http://www.psyshop.com/shop/CDs/trr/trr1cd007.html (form)
TestView = Backbone.View.extend(
manage: true
template: _.template("{{= artist }}") #"#album-temp"
serialize: ->
artist: "psykidellic"
)
.. This ends up just having : {{= artist }} in the DOM.
diff --git a/app/controllers/api/v1/auth_controller.rb b/app/controllers/api/v1/auth_controller.rb
index 81b0fe1..d8d81ed 100644
--- a/app/controllers/api/v1/auth_controller.rb
+++ b/app/controllers/api/v1/auth_controller.rb
@@ -2,7 +2,7 @@ class Api::V1::AuthController < Api::V1::ApiController
skip_before_filter :verify_authenticity_token, only: [:signIn, :signOut]
before_filter :ensure_params_exist, only: :signIn
- before_filter :authenticate_user!, only: [:updateUser, :getUser, :updatePassword]
+ before_filter :authenticate_user!, only: [:getUser, :updatePassword]
# httperf --method POST -data "{page:1}"
# dev.beamto.us
/ think=2.0
/api/v1/getTrendingAlbums method=POST contents="{page:1}"
/api/v1/getTrendingAlbums method=POST contents="{page:2}"
/
/api/v1/getTrendingAlbums method=POST contents="{page:3}"
/api/v1/getTrendingAlbums method=POST contents="{page:1}"
/api/v1/getTrendingAlbums think=2.0 method=POST contents="{page:1}"
-- Run script that dumps DB data into csv over S3
-- Run EMR script to while will process the data - maybe executed as cron from our ec2?
-- Saves processed data in CSV over s3
-- Scripts runs and puts the data from CSV into PGSQL DB.
-- Remove old CSV, new CSV and close the EMR instance.
_ = require('underscore')
Backbone = require('backbone')
data =
id: 1
queue_items: [
id: 1
song:
id: 1
name: 'song 1'
@psykidellic
psykidellic / gist:6057093
Created July 22, 2013 19:57
rspec return issue
describe "'getLibrary'" do
let (:user) { FactoryGirl.create(:user) }
let (:album) { FactoryGirl.create(:album) }
let (:library) { FactoryGirl.create(:library, :user => user, :album => album ) }
it "returns http success 200" do
sign_in user
post 'getLibrary'
puts response.body