This file contains hidden or 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
import _ from 'lodash' | |
import qs from 'qs' | |
// @see https://www.contentful.com/developers/docs/references/images-api/#/reference/resizing-&-cropping/specify-width-&-height | |
const CONTENTFUL_IMAGE_MAX_SIZE = 4000 | |
const isImage = image => | |
_.includes( | |
[`image/jpeg`, `image/jpg`, `image/png`, `image/webp`, `image/gif`], | |
_.get(image, `file.contentType`) | |
) |
This file contains hidden or 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
<Media query="(max-width: 550px)"> | |
{matches => | |
matches ? ( | |
<CardCarousel> | |
{blogs.map((blog, index) => { | |
return ( | |
<Link | |
key={index} | |
to={blog.node.fields.path} | |
> |
This file contains hidden or 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
class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[5.1] | |
def change | |
create_table(:users) do |t| | |
## Required | |
###### | |
# Truncated so i can show my example | |
###### | |
## User Info |
This file contains hidden or 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
class User < ActiveRecord::Base | |
# Include default devise modules. | |
devise :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable, :validatable, | |
:confirmable, :omniauthable | |
include DeviseTokenAuth::Concerns::User | |
end |
This file contains hidden or 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
class Api::V1::PhoneVerificationsController < ApplicationController | |
def start | |
response = Authy::PhoneVerification.start(via: "sms", country_code: 1, phone_number: phone_number_params) | |
if response.ok? | |
# verification was started | |
render json: {"success": true, message: "Verification code was sent to your phone number"}, status: :ok | |
else | |
render json: response | |
end |
This file contains hidden or 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
class Api::V1::PhoneVerificationsController < ApplicationController | |
def start | |
response = Authy::PhoneVerification.start(via: "sms", country_code: 1, phone_number: phone_number_params) | |
if response.ok? | |
# verification was started | |
render json: {"success": true, message: "Verification code was sent to your phone number"}, status: :ok | |
else | |
render json: response | |
end |
This file contains hidden or 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
# For phone verification | |
gem 'authy' | |
# gem for user authentication | |
gem 'devise_token_auth' | |
# needed for devise_token_auth to work | |
gem 'omniauth' |