Skip to content

Instantly share code, notes, and snippets.

songs_controller.rb
class SongsController < ApplicationController
before_filter :authenticate_user!
# GET /songs
# GET /songs.json
def index
@songs = Song.all
class Category < ActiveRecord::Base
has_many :topics, :order => "name ASC"
has_many :entries, :through => :topics
# Public: Return an Array of categories with included topics
# and entries as hash values.
#
# search_results - An array of entries
#
#!/usr/bin/env ruby
# This is the Skillpunch boostrap file. It will help you getting your dev
# environment up and running in no time!
# Execute this script from within the root folder of the project using:
# => `script/bootstrap`
#
require 'rubygems'
require 'colored'
require 'hpricot'
@freshfey
freshfey / gist:3168757
Created July 24, 2012 08:10
Songs Controller
class SongsController < ApplicationController
before_filter :authenticate_user!
# GET /songs
# GET /songs.json
def index
@songs = Song.all
respond_to do |format|
@freshfey
freshfey / gist:3168759
Created July 24, 2012 08:11
Song Model
class Song < ActiveRecord::Base
belongs_to :user
acts_as_voteable
has_attached_file :music, :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml"
validates_attachment_content_type :music, :content_type => ['application/mp3', 'application/x-mp3', 'audio/mpeg', 'audio/mp3' ],
:message => 'file must be of filetype .mp3!'
function dailyStatsParser() {
var ss = SpreadsheetApp.openById("0AhDr-PBlhQuYdExJbFNCVkJUa28ybHRVMEUyaVdsUWc");
var now = new Date();
var yesterday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1, now.getHours());
var yesterdayString = Utilities.formatDate(yesterday, "CET", "yyyy-MM-dd");
var fileNames = new Array("Tutti.ch stats ", "Tutti.ch (de) stats ", "Tutti.ch (fr) stats ", "Tutti.ch (it) stats ");
var docIDs = new Array();