Skip to content

Instantly share code, notes, and snippets.

View AhmetEnesKCC's full-sized avatar
🖥️
Coding...

Ahmet Enes KCC AhmetEnesKCC

🖥️
Coding...
View GitHub Profile
if (
document.getElementById("btnSignCommon-1") &&
document.getElementById("btnSignCommon-2")
) {
document
.getElementById("btnSignCommon-1")
.addEventListener("click", function () {
window.location.href = "login.html";
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
console.log("Game Started");
const options = ["tas", "kagit", "makas"];
@AhmetEnesKCC
AhmetEnesKCC / cashier.go
Created August 28, 2023 13:15
cashier app
package main
import (
"fmt"
)
type Item struct {
Name string
Price float64
discount float64
```go
package main
import (
"fmt"
)
type Item struct {
Name string
Price float64
#include <iostream>
using namespace std;
void swap(int * array, int index1, int index2) {
int temp = array[index1];
array[index1] = array[index2];
array[index2] = temp;
}
bool willMoveNext(int number, int nextNumber) {
{
"extends": [
"next",
"eslint:recommended",
"next/core-web-vitals",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
@AhmetEnesKCC
AhmetEnesKCC / index.jsx
Created March 19, 2022 13:45
website theme related to system - custom hook using
import React from "react";
import {useSetThemeRelatedToSystem }
export default App = () => {
const {theme} = useSetThemeRelatedToSystem();
return <div> {theme ? theme : "getting system theme" } </div>
}
@AhmetEnesKCC
AhmetEnesKCC / useSetThemeRelatedToSystem.js
Created March 19, 2022 13:42
set sytem theme related to system custom-hook
import {useState, useEffect} from "react";
import {getSystemTheme, watchSytemTheme, setTheme as setWebsiteTheme } from "functions-path" // you need export them separately. I changed name for prevent name collision with local state below.
// Creating custom hook - must be 'use' at the starting of function name
const useSetThemeRelatedToSystem = () => {
// create theme state
const setThemeRelatedToSystem = () => {
// ... rest of the function's code
}
// Plain JS
document.addEventListener("DOMContentLoad", () => {
setThemeRelatedToSystem();
})
@AhmetEnesKCC
AhmetEnesKCC / setThemeRelatedToSystem.js
Last active March 19, 2022 13:29
Set Theme Related To System
const setThemeRelatedToSystem = () => {
const getSystemtheme = () => {
// ... rest of the function code
}
const setTheme = (theme) => {
// ... rest of the funciton code
}