Skip to content

Instantly share code, notes, and snippets.

View stve's full-sized avatar

Steve Agalloco stve

View GitHub Profile
# encoding: utf-8
require 'rails/railtie'
module Development
module Environment
class Railtie < ::Rails::Railtie
config.before_initialize do
env_path = File.expand_path("../../.env", __FILE__)
if File.exist?(env_path)
File.open(env_path) do |file|
@stve
stve / sitestream.rb
Created March 26, 2012 04:47
TweetStream SiteStream example
require 'tweetstream'
require 'yajl'
TweetStream.configure do |config|
config.consumer_key = ENV['consumer_key']
config.consumer_secret = ENV['consumer_secret']
config.oauth_token = ENV['oauth_token']
config.oauth_token_secret = ENV['oauth_token_secret']
config.parser = :yajl
config.auth_method = :oauth
@stve
stve / gist:1933465
Created February 28, 2012 16:25
Github Issue labels and colors (copied from Jeremy Ashkenas)
bug #F11700
invalid #E6E6E6
change #3B812F
duplicate #AEAEAE
enhancement #6EAFEF
fixed #000000
frozen #C7FF80
question #E572BB
wontfix #FFFFFF
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