I hereby claim:
- I am ec on github.
- I am ec (https://keybase.io/ec) on keybase.
- I have a public key whose fingerprint is CFF1 4DEF 6ADF A722 5190 D9AD 7CFC 2DB6 12FD 1FF5
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
class ApplicationController < ActionController::Base | |
# protect_from_forgery | |
before_filter :authenticate_user_from_token! | |
before_filter :authenticate_user! #for classic Devise authentication | |
def authenticate_user_from_token! | |
access_token = params[:access_token].presence | |
if access_token | |
user = User.find_by_authentication_token(access_token.to_s) | |
class User < ActiveRecord::Base | |
devise :trackable, :validatable, :database_authenticatable, :rememberable, | |
:omniauthable, :omniauth_providers => [:google_oauth2] | |
attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :provider, :uid | |
def self.find_by_authentication_token(access_token) | |
client = OAuth2::Client.new(ENV['GOOGLE_OAUTH2_ID'],ENV['GOOGLE_OAUTH2_SECRET']) | |
begin | |
response = client.request(:get, 'https://www.googleapis.com/oauth2/v2/tokeninfo', :params => { |
config.action_mailer.delivery_method = :smtp | |
config.action_mailer.smtp_settings = { | |
:address => ENV['SMTP_HOST'], | |
:port => 587, | |
:authentication => :plain, | |
:user_name => ENV['SMTP_USERNAME'], | |
:password => ENV['SMTP_PASSWORD'], | |
:domain => ENV['SMTP_DOMAIN'], | |
:enable_starttls_auto => true | |
} |
# | |
# Domokun.rb | |
# | |
# Created by Emanuel Carnevale on 2008-08-30. | |
# Copyright (c) 2008 emanuelcarnevale.com. All rights reserved. | |
# | |
require "hpricot" | |
require 'open-uri' | |
Shoes.app(:title => "Domo nom nom", :width => 550, :height => 600, :resizeable => false) do |
# Just a lil app to test out the new fonts in Shoes. | |
Shoes.app do | |
stack do | |
Shoes::FONTS.each { |font| | |
inscription font, :stroke => red | |
para font, :font => font | |
} | |
end | |
end |
class Image(webapp.RequestHandler): | |
def get(self): | |
url = "http://api.thumbalizr.com/?url=http://www.ford.de&width=250" | |
response = urlfetch.fetch(url) | |
if response.status_code == 200: | |
self.response.headers['Content-Type'] = "image/jpg" | |
self.response.out.write(response.content) | |
else: | |
self.error(404) |
# | |
# Pong Challenge, copycat version | |
# | |
# Created by Emanuel Carnevale on 2008-11-18. | |
# Shamelessly adapted by http://billmill.org/pong.html | |
Shoes.app :width => 400, :height => 400, :resizable => false do | |
paddle_size = 75 |
# 1) Point *.example.com in your DNS setup to your server. | |
# | |
# 2) Setup an Apache vhost to catch the star pointer: | |
# | |
# <VirtualHost *:80> | |
# ServerName example.com | |
# ServerAlias *.example.com | |
# </VirtualHost> | |
# | |
# 3) Set the current account from the subdomain |