Skip to content

Instantly share code, notes, and snippets.

View stve's full-sized avatar

Steve Agalloco stve

View GitHub Profile
require 'feedzirra'
module ItunesFeed
module Music
DEFAULT_FEED_TYPE = 'topalbums'
def music
@feed_type = ItunesFeed::Music::DEFAULT_FEED_TYPE
self
@stve
stve / authentication.feature
Created May 19, 2011 13:05
OmniAuth cukes
Feature: Authentication
In order to attract interest and users to Futureish
As a product development team
I want users to login via twitter
So that they can create a Futureish account
Scenario: Authentication via Twitter
Given I am logged in on twitter
When I go to the homepage
And I follow "Login with Twitter"
@stve
stve / content_post.rb
Created December 31, 2010 20:08
Using Ruby to post to a Facebook Page's wall
post_data = {}
post_data[:name] = 'Title for my link'
post_data[:link] = 'http://path.to/my/link'
post_data[:caption] = 'A caption'
post_data[:description] = 'A description'
post_data[:picture] = 'http://path.to/myimage.jpg'
post_data[:actions] = { :name => 'My site name', :link => 'http://link.to/my/site'}.to_json
client.post("feed", nil, post_data)
@stve
stve / Gemfile
Created September 24, 2010 04:02
source "http://rubygems.org"
gem 'tweetstream'
gem 'yajl-ruby'
gem 'growl'
require 'rubygems'
gem 'httparty', '= 0.4.3'
require 'httparty'
require 'tinder'
require 'feedzirra'
require 'nokogiri'
current_woot = nil
woot_url = 'http://woot.com/Blog/Feed.ashx'
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked
# We're in smart spawning mode.
Member.connection.reconnect!
Rails.cache.instance_variable_get(:@cache).quit if Rails.cache.class == ActiveSupport::Cache::LibmemcachedStore
else
# We're in conservative spawning mode. We don't need to do anything.
end
end
namespace :cache do
namespace :fragment do
desc 'Manually remove all fragment caches'
task :delete => :environment do
ActionController::Base.cache_store.clear
end
end
end
@stve
stve / git-track
Created June 16, 2010 04:58 — forked from jamie/git-track
#!/usr/bin/env ruby
# Sets up remote tracking if you forgot to --track a branch,
# or if you're setting up a new branch.
# Save in ~/bin/ or somewhere else on your path.
# Usage:
# git track [[remote] branch]
# remote defaults to 'origin'
# branch defaults to the name of the current local branch
if request.accept.include?('application/json')
content_type :json
else
content_type :text
end
# MongoMapper "embedded document delete" plugin
# By Peter Cooper
#
# Got embedded documents you want to delete? You can delete them as if the
# embedded document collection were an array, but then there's no way to get
# a callback (as far as I could tell). This plugin gives you a call back
# (if you want it) and gives a nicer syntax to deleting embedded docs.
#
# Example:
#