Skip to content

Instantly share code, notes, and snippets.

def login(user=nil)
u = user || create(:user)
visit new_user_session_path
within("#new_user") do
fill_in 'Email', :with => u.email
fill_in 'Password', :with => '12345678'
click_button 'Log in'
end
end
@bigfleet
bigfleet / mailchimp-signup
Created May 12, 2014 14:43
Basic, naked Mailchimp signup for Code for Charlotte
<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="http://itsbspoke.us2.list-manage.com/subscribe/post?u=8b4656bd4a093a3bcabfda08a&amp;id=4f80c66e83" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div class="mc-field-group">
<label for="mce-EMAIL">Email Address </label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
- include: dot-env.yml
- include: capistrano.yml
- include: bundle.yml
when: $bundle
- include: db.yml
- include: unicorn.yml
when: $unicorn
- include: foreman.yml
when: $foreman
- include: nginx.yml
class FacebookInterface
def self.for(user)
auth = user.authentications.where(provider: "facebook").first
return if auth.nil?
return if auth.oauth_token.nil?
FacebookInterface.new(Koala::Facebook::API.new(auth.oauth_token))
end
def initialize(api)
@api = api
class CreateAuthentications < ActiveRecord::Migration
def change
create_table :authentications do |t|
t.integer :user_id
t.string :provider
t.string :uid
t.string :name
t.string :oauth_token
t.datetime :oauth_expires_at
@bigfleet
bigfleet / README.md
Created October 21, 2013 17:54
Facebook, Omniauth, and Rails 4 companion gist

Find this post at URL

@bigfleet
bigfleet / gist:6545091
Created September 12, 2013 23:16
A sample Postgresql config/database.yml file
development:
adapter: postgresql
encoding: unicode
database: app_development
pool: 5
# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
# domain sockets, so uncomment these lines.
#host: localhost
# -*- coding: utf-8 -*-
require 'fileutils'
require 'date'
require 'yaml'
require 'uri'
require 'rexml/document'
include REXML
doc = Document.new File.new(ARGV[0])
mike@rbci:~$ psql -U postgres
psql (9.0.3)
Type "help" for help.
postgres=# update pg_database set datallowconn = TRUE where datname = 'template0';
UPDATE 1
postgres=# \c template0
You are now connected to database "template0".
template0=# update pg_database set datistemplate = FALSE where datname = 'template1';
UPDATE 1
@bigfleet
bigfleet / querying.citrus
Last active October 12, 2018 06:15
My citrus effort
grammar Querying
rule statement
(compound_predicate | predicate)
end
rule compound_predicate
(predicate space* operator_and_predicate){
Wither::CompoundPredicate.new(predicate.value,
operator_and_predicate.group_operator.value,