This file contains hidden or 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
# In my controller | |
monitor :only => [:create,:destroy], | |
:alias => {:create => :voted}, | |
:target => :voteable | |
# Calls this method in my ActivityLogger module | |
def monitor(options = {}) | |
if !options.has_key?(:only) && !options.has_key?(:except) | |
options[:only] = [:show,:create,:update,:destroy] | |
end |
This file contains hidden or 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 ActivityMonitor | |
include Tracking::ActivityMonitor | |
def initialize | |
monitor Answer, :only => [:update,:destroy,:create], | |
:alias => {:create => :answered}, | |
:target => :question | |
monitor Company |
This file contains hidden or 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
source :gemcutter | |
gem "rails", "2.3.4" | |
gem "pg" | |
# bundler requires these gems in all environments | |
gem 'will_paginate' | |
gem 'warden' | |
gem 'devise', "1.0.8" | |
gem "panda", "1.0" | |
gem 'formtastic', '1.1' |
This file contains hidden or 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
def enqueue_for_encoding | |
notifications = [] | |
notifications << "#{AppConfig.zencoder.callback_url.sub(/:id/,id.to_s)}" unless Rails.env == 'development' | |
#Make sure that urls match url in the has_attached_file method in video,thumbnail and encodings! | |
#TODO: Don't make the default security public | |
response = Zencoder::Job.create({ | |
:input => raw.url, | |
:output => {:label => "base", |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" | |
xmlns:s="library://ns.adobe.com/flex/spark" | |
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="336" minHeight="280" width="336" height="280" includeInLayout="true" click="handleClick(event)"> | |
<fx:Script> | |
<![CDATA[ | |
public function handleClick(mouseEvent:MouseEvent):void { | |
navigateToURL(new URLRequest(root.loaderInfo.parameters.clickTAG),"_blank"); |
This file contains hidden or 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
# Used to replace Abingo:Statistics | |
# | |
# Background here: http://en.wikipedia.org/wiki/F-test | |
# Has access to the following variables when included in an ABingo::Experiment | |
# | |
# TODO: Get a real stat guy to confirm my analysis | |
# Question: Does this work when there are varing observations per level | |
# | |
# alternatives (includes conversion_rate and participants) | |
# best_alternative |
This file contains hidden or 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
def load_env(rubber_only=true) | |
env = ENV["RUBBER_ENV"] ||= "development" | |
root = File.expand_path('../..', __FILE__) | |
rails_env_file = File.join(root, 'config', 'environment.rb') | |
if ! rubber_only && File.exists?(rails_env_file) | |
require(rails_env_file) | |
else | |
require 'yaml' | |
YAML::ENGINE.yamler= 'syck' |
This file contains hidden or 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
# Add your own tasks in files placed in lib/tasks ending in .rake, | |
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | |
require File.expand_path('../config/application', __FILE__) | |
require 'rake' | |
Statsamurai::Application.load_tasks |
This file contains hidden or 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
# My own little Memcache | |
class KeyValueStore | |
include Mongoid::Document | |
include Mongoid::Timestamps::Created | |
field :key, type: String | |
field :value, type: Binary | |
field :expires, type: Time | |
DEFAULT_EXPIRY = 1.minute |
This file contains hidden or 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 Zencoder | |
class Job < Base | |
def self.create(params={}, options={}) | |
params = apply_api_key(params, options[:format]) | |
HTTP.post("#{options[:base_url] || base_url}/jobs", | |
encode(params, options[:format]), | |
options) | |
end |
OlderNewer