Skip to content

Instantly share code, notes, and snippets.

View koraytugay's full-sized avatar
👋

Koray Tugay koraytugay

👋
View GitHub Profile
@koraytugay
koraytugay / scratch.html
Created November 12, 2022 15:38
Fetch vs XMLHttpRequest
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>On Load</title>
</head>
<body>
@koraytugay
koraytugay / App.js
Created November 6, 2022 01:01
React useState Example
import {useState} from 'react';
const App = () => {
const [counter, setCounter] = useState(0);
const incrementHandler = () => setCounter(counter + 1);
const decrementHandler = () => setCounter(counter - 1);
return (
<>
<!doctype html>
<head>
<style>
body {
font-family: sans-serif;
}
h1 {
color: #2f4f4f;
font-weight: normal;
@koraytugay
koraytugay / axiosAndFetch.js
Created August 22, 2021 01:36
axios and fetch example
// axios example
const axios = require('axios').default;
// Make a request for a user with a given ID
let employeePromise = axios.get('https://fakejsonapi.com/fake-api/employee/api/v1/employees');
let onfulfilled = function(response) {
// handle success
console.log(response.data.data[0]);
};
@koraytugay
koraytugay / strictmode.txt
Created August 15, 2021 00:24
What is strict mode in JS?
Strict mode is an ES5 addition to JavaScript that changes the behavior of JavaScript engines so that errors are thrown instead of silently picked up.
The behavior of some language features is changed, and some unsafe language features are even completely banned.
One of the things that strict mode changes is that it disables arguments aliasing.
@koraytugay
koraytugay / myclient.html
Created August 1, 2021 22:00
Express Server
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
.photoContainer {
margin: 10px
}
</style>
</head>
@koraytugay
koraytugay / flickrfetch.html
Last active August 1, 2021 19:26
Flickr - Fetch Photos
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline' *.flickr.com *.staticflickr.com">
<title>Page Title</title>
<style>
.photoContainer {
margin: 10px
}
</style>