Skip to content

Instantly share code, notes, and snippets.

View adamjleonard's full-sized avatar

Adam Leonard adamjleonard

View GitHub Profile
# app/graphql/types/review_type.rb
Types::ReviewType = GraphQL::ObjectType.define do
name "Review"
field :id, types.ID
field :content, types.String
end
# app/graphql/types/mutation_type.rb
Types::MutationType = GraphQL::ObjectType.define do
name "Mutation"
field :createMovie, Types::MovieType do
argument :title, !types.String
argument :description, !types.String
resolve -> (obj, args, ctx) {
@adamjleonard
adamjleonard / query_type.rb
Created February 5, 2018 15:35
query_type.rb
Types::QueryType = GraphQL::ObjectType.define do
name “Query”
# Add root-level fields here.
# They will be entry points for queries on your schema.
field :allMovies do
type types[Types::MovieType]
description “A list of all the movies”
resolve -> (obj, args, ctx) {
Movie.all
# In the app/graphql/types/movie_type.rb file
Types::MovieType = GraphQL::ObjectType.define do
name “Movie”
field :id, !types.ID
field :title, !types.String
field :description, types.String
end
Movie.create(
title: ‘Deadly Weapon’,
description: ‘2 retired monks walk into a bar’
)
Movie.create(
title: ‘Deadly Weapon 2 — This time time it’s personal’,
description: ‘Like Deadly Weapon, only deadlier and more personal’
)
let parseConfiguration = ParseClientConfiguration(block: { (ParseMutableClientConfiguration) -> Void in
ParseMutableClientConfiguration.applicationId = ""
ParseMutableClientConfiguration.clientKey = ""
ParseMutableClientConfiguration.server = ""
})
Parse.initializeWithConfiguration(parseConfiguration)
func requestFingerprintAuthentication() {
let context = LAContext()
var authError: NSError?
let authenticationReason: String = "To display a message to the user"
if context.canEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, error: &authError) {
context.evaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, localizedReason: authenticationReason, reply: {
(success: Bool, error: NSError?) -> Void in
if success {
self.updateMessageLabel("Woohoo")
func requestFingerprintAuthentication() {
let context = LAContext()
var authError: NSError?
let authenticationReason: String = "To display a message to the user"
if context.canEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, error: &authError) {
context.evaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, localizedReason: authenticationReason, reply: {
(success: Bool, error: NSError?) -> Void in
if success {
dispatch_async(dispatch_get_main_queue(), {
func requestFingerprintAuthentication() {
let context = LAContext()
var authError: NSError?
let authenticationReason: String = "To display a message to the user"
if context.canEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, error: &authError) {
}
}
func requestFingerprintAuthentication() {
let context = LAContext()
var authError: NSError?
let authenticationReason: String = "To display a message to the user"
}