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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<style> |
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
function y(z){ | |
console.log(arguments.length) | |
} | |
var x = { | |
length: 5, | |
method: function(y){ | |
console.log(arguments.length) | |
} | |
} |
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 cv = { | |
age: 20, | |
name: 'akif', | |
title: 'web developer', | |
contact: { | |
number: '0535-232-22-17' | |
}, | |
address: { | |
home: 'bornova', | |
scholl: { |
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
version: '3.7' | |
services: | |
postgres: | |
image: postgres:latest | |
restart: always | |
environment: | |
- POSTGRES_USER=campusUsername | |
- POSTGRES_PASSWORD=campusPassword | |
- POSTGRES_DB=campus_db |
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 GraphqlResponse { | |
final bool success; | |
final data; | |
GraphqlResponse({required this.success, required this.data}); | |
} | |
class GraphqlService { | |
GraphqlService._privateConstructor(); | |
static final GraphqlService _instance = GraphqlService._privateConstructor(); | |
static GraphqlService get instance => _instance; |
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
Uri url = Uri.parse('http://localhost:3000/graphql'); | |
var response = await http.post( | |
url, | |
headers: { | |
"Content-Type": "application/json", | |
"Accept": "application/json", | |
}, | |
body: jsonEncode({"query": query, "variables": variables}), | |
); |
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
Map variables = { | |
'productId': productId, | |
'content': comment, | |
'rating': rating, | |
'images': images | |
}; |
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
String query = ''' | |
mutation CREATE_COMMENT(\$productId: String!, \$content: String!, \$rating: Float!, \$images: [String!]!){ | |
createComment(productId: \$productId, comment: {content: \$content , rating: \$rating, images: \$images }){ | |
content, | |
rating, | |
userId | |
} | |
} | |
'''; |
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
requestfile.onupgradeneeded = function (event) { | |
var db = event.target.result; | |
var objectStore = db.createObjectStore("photos", { keyPath: "id", autoIncrement: true }); | |
}; |
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
document.getElementById('second').addEventListener('submit', e => { | |
e.preventDefault() | |
const fileName = document.getElementById('filename').value //text değerimizi aldık | |
const file = document.getElementById('file').files[0] //dosyamızı File Objemizi aldık | |
var request = window.indexedDB.open("file", 1); //veritabanımızı açıyoruz | |
request.onsuccess = function (event) { | |
var db = event.target.result; //veritabanımız başarılı bir şekilde açıldı | |
var objectStore = db.transaction('photos', 'readwrite').objectStore('photos') //Tablomuzu seçtik. Yukarıda bahsettiğim gibi transaction fonksiyonunu indexedb de sürekli kullanıyoruz. Transaction işlemini yapacağımız objectStore ve daha sonra ekleme yapacağımız objectStoreyi seçiyoruz. | |
objectStore.put({ fileName, file }).onsuccess = function () { | |
console.log('ok!');//verilerimizi kayıt ettiğimizde çalışacak fonksiyonumuz aynı şekilde onerror eventini yakalayabilirsiniz. |