Skip to content

Instantly share code, notes, and snippets.

Feyyaz Alingan freshfey

View GitHub Profile
View google-script
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();
View gist:3168759
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!'
@freshfey
freshfey / gist:3168757
Created Jul 24, 2012
Songs Controller
View gist:3168757
class SongsController < ApplicationController
before_filter :authenticate_user!
# GET /songs
# GET /songs.json
def index
@songs = Song.all
respond_to do |format|
View gist:3168755
#!/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'
View categorysnippet.rb
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
#
View artistsurfer question
songs_controller.rb
class SongsController < ApplicationController
before_filter :authenticate_user!
# GET /songs
# GET /songs.json
def index
@songs = Song.all
You can’t perform that action at this time.