Skip to content

Instantly share code, notes, and snippets.

@cousine
cousine / remote_sessions_controller.rb
Created November 15, 2010 13:18
Sing Sign-in Solutions in Rails using Authentasaurus: The provider
# ---------------------------------- Add in app/controllers/remote_sessions_controller.rb
# This will handle the first step of authenticating through a token
def authenticate_token
# Read the token from the cookie
token = Token.authenticate cookies.signed[:provider_token]
# Find application in the database
current_application = App.find_by_name params[:application]
# Get the application url so we can redirect the user back to it.
@cousine
cousine / routes.rb
Created November 15, 2010 13:43
Sing Sign-in Solutions in Rails using Authentasaurus: The consumer
## Authentasaurus configuration
development: &non_production_settings
:hashing: "SHA2" # MD5 - SHA1 - SHA2
:mail:
:email: &development_email "foo_bar@your-domain.com"
:host: "http://localhost:3001/"
:modules:
:remote:
:user:
:site: "http://localhost:3000/application_name"
# encoding: utf-8
module Mongoid #:nodoc:
module Associations #:nodoc:
module EmbeddedCallbacks
# bubble callbacks to embedded assocaitions
def run_callbacks(*args)
# now bubble callbacks down
self.associations.each_pair do |name, meta|
if meta.association == Mongoid::Associations::EmbedsMany
@cousine
cousine / gist:1151875
Created August 17, 2011 16:05
Models structure
class MongoidAlpha
include Mongoid::Document
#include Mongoid::Mebla
field :name
field :value, :type => Integer
field :cost, :type => Float
field :hidden
#self.whiny_indexing = true
@cousine
cousine / dabblet.css
Created January 10, 2012 16:37 — forked from daneden/dabblet.css
Search Suggestions
/*
Search Suggestions
Original design by Visual Idiot - http://dribbble.com/shots/377281-Search-Suggestions
*/
html {
min-height: 100%;
background: -webkit-linear-gradient(#dbddde, #b6babb);
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
@cousine
cousine / ruby_debug_pow.markdown
Created January 19, 2012 10:48 — forked from alexagui/ruby_debug_pow.markdown
How to Ruby Debug with Pow

How to Ruby Debug with Pow

Below are steps I followed to get ruby debugger ruby-debug running with Pow. Based on info from this thread basecamp/pow#43 and this blog post http://flochip.com/2011/04/13/running-pow-with-rdebug/

1) Update your Gemfile

Assuming you're writing your app in Ruby 1.9 and using Bundler, just add the dependency to your development gems:

@cousine
cousine / es.sh
Created October 23, 2012 00:42
Install ElasticSearch on Ubuntu 12.04
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.10.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@cousine
cousine / resources.md
Created October 22, 2017 10:11
Ruby learning videos

Keybase proof

I hereby claim:

  • I am cousine on github.
  • I am cousine (https://keybase.io/cousine) on keybase.
  • I have a public key ASCKIJHRzc2i0n3JrN1tYmRZGH2JYXRm6Yr5SpZ7eRkVowo

To claim this, I am signing this object: