Skip to content

Instantly share code, notes, and snippets.

View natarius's full-sized avatar

Matthias natarius

View GitHub Profile
@natarius
natarius / email_crawler.rb
Last active December 13, 2015 17:38
Crawl email addresses from a site including recursive following all links on that domain.
class EmailCrawler
require 'rubygems'
require 'mechanize'
require 'parallel'
attr_accessor :links, :crawl_host, :parsed_sites
def crawl(url)
@links = Array.new
@parsed_sites = Array.new
@natarius
natarius / gibbon.rb
Created February 14, 2013 23:09
Automatically add the users that sign up to your rails app to a mailchimp list. I usually do this async via Resque and not exactly like in this snippet
Gibbon.api_key = ENV["MAILCHIMP_API_KEY"]
@natarius
natarius / Gemfile
Last active December 13, 2015 18:39
Nice little snipped to get your users friends from Facebook/Twitter and merge/autocomplete them. It will also notify the users that their friends signed up via email or whatever you want to implement. It can group does notifications in batches, to create waves of people who know each other and be notified in a short timespan :) Requires a workin…
gem 'resque'
gem 'resque-scheduler', "~> 2.0.0", :require => 'resque_scheduler'
gem 'parallel', "~> 0.5.16"
gem 'fb_graph', "~> 2.4.4"
gem "twitter"
gem 'mongoid'
@natarius
natarius / gist:4972942
Created February 17, 2013 19:19
Array with US State names and their abbreviation
[
{:name => "Alaska", :abbreviation => "AK"},
{:name => "Alabama", :abbreviation => "AL"},
{:name => "American Samoa", :abbreviation => "AS"},
{:name => "Arizona", :abbreviation => "AZ"},
{:name => "California", :abbreviation => "CA"},
{:name => "Colorado", :abbreviation => "CO"},
{:name => "Connecticut", :abbreviation => "CT"},
{:name => "District of Columbia", :abbreviation => "DC"},
{:name => "Delaware", :abbreviation => "DE"},
class ApplicationController < ActionController::Base
after_filter :store_referrer
protected
def store_referrer
return if referred_from_here? or request.format != 'text/html'
referrer_data = {