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
type Person { | |
title: String | |
name: String | |
} |
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
apollo schema:download --endpoint=<your_endpoint>/graphql schema.json --header="x-api-key: <your-api-key" |
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 Foundation | |
import Apollo | |
class Network { | |
static let shared = Network() | |
let apollo: ApolloClient = { | |
let configuration = URLSessionConfiguration.default | |
configuration.httpAdditionalHeaders = [ | |
"x-api-key": "da2-tbx2kgzvp5bmlo4jxzhriavg3i" | |
] |
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
struct ImageUrlView: View { | |
@ObservedObject var remoteImageModel: RemoteImageModel | |
init(url: String?) { | |
remoteImageModel = RemoteImageModel(imageUrl: imageUrl) | |
} | |
var body: some View { | |
Image(uiImage: remoteImageModel.image ?? UIImage(named: "default-image-here")!) | |
.resizable() |
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 RemoteImageModel: ObservableObject { | |
@Published var displayImage: UIImage? | |
var imageUrl: String? | |
var cachedImage = CachedImage.getCachedImage() | |
init(imageUrl: String?) { | |
self.imageUrl = imageUrl | |
if imageFromCache() { | |
return | |
} |
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
struct ImageContentView : View { | |
@State var url = "https://link-to-image" | |
var body: some View { | |
VStack { | |
ImageView(url: url) | |
} | |
} |
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 Combine | |
import SwiftUI | |
struct ImageViewController: View { | |
@ObservedObject var url: LoadUrlImage | |
init(imageUrl: String) { | |
url = LoadUrlImage(imageURL: imageUrl) | |
} | |
var body: some View { |
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
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest(); | |
const mysql = require('mysql'); | |
const config = require('./config'); | |
const pool = mysql.createPool({ | |
connectionLimit: 10, | |
host: config.dbhost, | |
user: config.dbuser, | |
password: config.dbpass, | |
database: config.dbname | |
}); |
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
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest(); | |
var fs = require('fs') | |
fs.readFile('birthdays', 'UTF-8', function ( err, contents ) { | |
var birthdays = contents.toString().split('\n'); | |
const bdayPeople = birthdayToday(birthdays); | |
greetBirthday(bdayPeople); | |
}) | |
function birthdayToday(birthdays) { | |
var results = [] |
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
const express = require('express') | |
const app = express() | |
var path = require('path') | |
var bodyParser = require('body-parser') | |
app.use(express.static(path.join(__dirname, 'build'))); | |
var dataController = require('./dataController'); | |
app.get('/api/data', dataController.getData); |
OlderNewer