18MP Canon Rebel T2i vs. iPhone 4S
One of these pictures was taken with a 18 megapixel Canon Rebel T2i, and one was taken with an iPhone 4S.
Can you tell the difference? I'm really impressed with how well the iPhone fares...
One of these pictures was taken with a 18 megapixel Canon Rebel T2i, and one was taken with an iPhone 4S.
Can you tell the difference? I'm really impressed with how well the iPhone fares...
TL;DR; Paste the following into terminal and hit enter:
eval "$(curl -s https://gist.github.com/raw/972430/install-git-completion.sh)"
That's it! You will now have git completion! You can test it by typing git l and pressing "tab".
Continue reading for more details...
How it Works
When you run the previous command in terminal, it's going to download and run the following file:
This script downloads the correct version of the git-completion script from github, and adds a reference to it in your bash profile.
Update 8/17/2011 - Fixed the url in the script since github changed their url conventions.
gem "oa-oauth", :require => "omniauth/oauth"
You need to sign up for an appid and key from facebook at http://developers.facebook.com/setup
config.omniauth :facebook, 'appid', 'key'
Create a new controller at ‘/app/controllers/users/omniauth_callbacks_controller.rb’, and start with the following code:
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController def facebook # You need to implement the method below in your model @user = User.find_for_facebook_oauth(env["omniauth.auth"], current_user) if @user.persisted? flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Facebook" sign_in_and_redirect @user, :event => :authentication else session["devise.facebook_data"] = env["omniauth.auth"] redirect_to new_user_registration_url end end end
devise_for :user, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
Add :omniauthable to the devise helper in your user class.
class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable end
class User < ActiveRecord::Base def self.find_for_facebook_oauth(access_token, signed_in_resource=nil) data = access_token['extra']['user_hash'] if user = User.find_by_email(data["email"]) user else # Create an user with a stub password. User.create!(:email => data["email"], :password => Devise.friendly_token[0,20]) end end end
That’s it! For more information, here’s the devise wiki article I followed: OmniAuth:Overview
Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma - which is living with the results of other people's thinking. Don't let the noise of other's opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary.
- Steve Jobs
I've built a new chrome extension that will place a red marker (*New) next to any comments that you haven't seen yet. It's useful for tracking a discussion, and seeing which comments are new since the last time you've visited the thread.
Try it out at: https://chrome.google.com/webstore/detail/odbfgccplknfllkhjmpfogjbnacdkdcl
View the source at: https://github.com/johngibb/Hacker-News--Show-Unread-Comments
As I'm developing Rails applications, and I run into a feature I'm not familiar with, I always find myself using the same resources:
After realizing how much time I spend searching for resources I've already found before (not to mention the context switch and frustration of a failed search), I decided to throw together a quick site to keep track of what I've found before.
In the hopes that someone else could find it useful, I've decided to make it freely available.
Check it out at: http://rails-resources.heroku.com/
View the source at: https://github.com/johngibb/Rails-Resources
Here's what it looks like:
Let me know if you find it useful!