This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme", | |
"ensure_newline_at_eof_on_save": true, | |
"file_exclude_patterns": | |
[ | |
".DS_Store", | |
".tags*", | |
"*.pyc", | |
"*.pyo", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
class ConexionesController < ApplicationController | |
def linkedin | |
client = LinkedIn::Client.new(ENV['LINKEDIN_API_KEY'], ENV['LINKEDIN_SECRET'], {:request_token_path => '/uas/oauth/requestToken?scope=r_fullprofile+r_emailaddress'}) | |
request_token = client.request_token(:oauth_callback => "http://#{request.host_with_port}/conexiones/callback") | |
session[:rtoken] = request_token.token | |
session[:rsecret] = request_token.secret | |
redirect_to client.request_token.authorize_url | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OmniAuth.config.on_failure = Proc.new { |env| | |
OmniAuth::FailureEndpoint.new(env).redirect_to_failure | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/controllers/photos_controller.rb | |
@file = params[:file] || params[:facebook_image_url] | |
if params[:facebook_image_url] && params[:access_token] | |
@photo.image = open(@file + "?access_token=" + params[:access_token]) | |
else … |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/routes.rb | |
resources :photos, only: [:create] | |
resources :videos, only: [:create] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/controllers/videos_controller.rb | |
def destroy | |
video = Video.find params[:id] | |
video.destroy if video | |
render :nothing => true | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/controllers/sessions_controllers.rb | |
def login | |
url = "/auth/facebook" | |
url += "?" + params.try(:to_param) if params | |
session[:from] = params[:to] if params.any? | |
redirect_to url #unless user_signed_in? | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/controllers/sessions_controller.rb | |
class SessionsController < ApplicationController | |
def login | |
if current_user | |
redirect_to root_path | |
return | |
end | |
@redirect_path = { path: "/auth/facebook", message: { notice: "Logged in successfully" } } | |
parse_to_path if params[:to] | |
redirect_to @redirect_path[:path], @redirect_path[:message] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img | |
alt="" | |
class="producto-imagen" | |
src="productos/obtenerimagen/?id=5&useDensity=true&width=640&height=360&tipoEscala=contain" | |
data-bind="ghostTo: agregandoACarrito, ghostToTarget: $('.cartCount'), attr:{width: width, ___height: height}, src:imagenes.representativa && imagenes.representativa() && imagenes.representativa().get && imagenes.representativa().get({width: width, height: height, tipoEscala: 'contain', useDensity: true}) || '/img/px.gif'" | |
width="640" | |
___height="360" | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Which one is your preferred syntax? | |
# Indentation 1 | |
class Dummy | |
def public_method | |
end | |
private | |
def private_method | |
end |
OlderNewer