Tutorial by Examples: ad

belongs_to :user belongs_to :authentication_provider serialize :params def self.create_from_omniauth(params, user, provider) token_expires_at = params['credentials']['expires_at'] ? Time.at(params['credentials']['expires_at']).to_datetime : nil create( user: user, ...
include OmniauthAttributesConcern has_many :user_authentications devise :omniauthable, :database_authenticatable, :registerable,:recoverable, :rememberable, :trackable def self.create_from_omniauth(params) self.send(params.provider,params) end
module OmniauthAttributesConcern extend ActiveSupport::Concern module ClassMethods Add Methods here end end In this concern we can create methods for each social media to fetch and store attributes. def twitter params (params['info']['email'] = "dummy#{SecureRan...
devise_for :users, controllers: {omniauth_callbacks: 'users/omniauth_callbacks'}
For Facebook config.omniauth :facebook, facebook_app_id, facebook_secret_key, :display => "popup", :scope => 'email,publish_actions', info_fields: 'email,name' For Twitter config.omniauth :twitter, twitter_app_id, twitter_secret_key, :display => "popup", :scope =&gt...
gem 'omniauth-oauth2' , '~> 1.3.1' gem 'omniauth' gem 'omniauth-facebook' gem 'omniauth-twitter' gem 'omniauth-gplus' gem 'omniauth-linkedin' Run the bundle install command, restart your server and off you go!
This is a copy of the advanced function snippet from the Powershell ISE. Basically this is a template for many of the things you can use with advanced functions in Powershell. Key points to note: get-help integration - the beginning of the function contains a comment block that is set up to be ...
To work with ConstraintLayout, you need Android Studio Version 2.2 or newer and have at least version 32 (or higher) of Android Support Repository. Add the Constraint Layout library as a dependency in your build.gradle file: dependencies { compile 'com.android.support.constraint:constraint...
1. Print the Hadoop version hadoop version 2. List the contents of the root directory in HDFS hadoop fs -ls / 3. Report the amount of space used and available on currently mounted filesystem hadoop fs -df hdfs:/ 4. Count the number of directories,files and bytes under the paths tha...
For enabling Proguard configurations for your application you need to enable it in your module-level gradle file. You need to set the value of minifyEnabled to true. buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.t...
main.component.ts import {Component} from "@angular/core"; @Component({ selector: "main", template: ` <StackLayout> <TextField hint="some text"></TextField> <Button text="Click me" class="btn">...
When allocating multidimensional arrays with malloc, calloc, and realloc, a common pattern is to allocate the inner arrays with multiple calls (even if the call only appears once, it may be in a loop): /* Could also be `int **` with malloc used to allocate outer array. */ int *array[4]; int i; ...
The most common mode of using TensorFlow involves first building a dataflow graph of TensorFlow operators (like tf.constant() and tf.matmul(), then running steps by calling the tf.Session.run() method in a loop (e.g. a training loop). A common source of memory leaks is where the training loop conta...
There are several scopes that are available only in a web-aware application context: request - new bean instance is created per HTTP request session - new bean instance is created per HTTP session application - new bean instance is created per ServletContext globalSession - new bean instance i...
shadowColor = color // CSS color shadowBlur = width // integer blur width shadowOffsetX = distance // shadow is moved horizontally by this offset shadowOffsetY = distance // shadow is moved vertically by this offset This set of attributes will add a shadow around a path. Bo...
var gradient = createLinearGradient( startX, startY, endX, endY ) gradient.addColorStop(gradientPercentPosition, CssColor) gradient.addColorStop(gradientPercentPosition, CssColor) [optionally add more color stops to add to the variety of the gradient] Creates a reusable linear gradient (object...
var gradient = createRadialGradient( centerX1, centerY1, radius1, // this is the "display' circle centerX2, centerY2, radius2 // this is the "light casting" circle ) gradient.addColorStop(gradientPercentPosition, CssColor) gradient.addColorStop(gradientPerce...
nginx -c <file name> Start NGINX with an explicit configuration file.
Passing a pointer argument to a T* parameter, if possible, is better than passing it to a const T* parameter. struct Base {}; struct Derived : Base {}; void f(Base* pb); void f(const Base* pb); void f(const Derived* pd); void f(bool b); Base b; f(&b); // f(Base*) is better than f(const...

Page 44 of 114