Skip to content

Instantly share code, notes, and snippets.

View hkkcngz's full-sized avatar
💭
never git up

Hakkı Cengiz hkkcngz

💭
never git up
View GitHub Profile
@hkkcngz
hkkcngz / promises.md
Created July 28, 2024 10:00
JS Promises

JavaScript Promises Cheatsheet


1. Basit Promise Tanımı

let sayHello = new Promise(function(resolve, reject) {
  // Hata durumunda reject kullanılır
@hkkcngz
hkkcngz / preventObjectAddingNewProperties.md
Last active July 16, 2024 18:33
Javascript Blocking Adding New Key Value to Object

Prevent Object from adding new Properties in JavaScript

Learn how to use preventExtensions to stop adding new properties to a JavaScript Object

The Object.preventExtensions() method prevents new properties from added to an object.

`` "use strict"; let user = { name : "Jagathish" };

@hkkcngz
hkkcngz / style.scss
Created June 9, 2024 21:08
appear animation css
@keyframes appear {
from {
opacity: 0;
scale: 0.5;
}
to {
opacity: 1;
scale: 1;
}
}
@hkkcngz
hkkcngz / next.config.js
Created February 26, 2024 00:20 — forked from LearnWebCode/next.config.js
For outputting static HTML files from Next.js that any server can easily host (I was integrating with an old WordPress site for the rest of the domain)
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
output: "export",
trailingSlash: true,
images: { unoptimized: true }
}
module.exports = nextConfig
@hkkcngz
hkkcngz / remove_node_modules_recursively.ps1
Created January 17, 2024 16:26 — forked from SynCap/remove_node_modules_recursively.ps1
Remove `node_modules` folders in Windows in all subfolders recursively with PowerShell to avoid exceeding path max_length
<#
Note: Eliminate `-WhatIf` parameter to get action be actually done
Note: PS with version prior to 4.0 can't delete non-empty folders
#>
Get-ChildItem -Path "." -Include "node_modules" -Recurse -Directory | Remove-Item -Recurse -Force -WhatIf
@hkkcngz
hkkcngz / generate-pushid.js
Created October 24, 2023 00:56 — forked from mikelehen/generate-pushid.js
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
As of 2023
Open VSCode's command menu (F1), and type "Local History" and select "Local History: Find Entry to Restore."
Then type the name of the file you deleted.
This has worked for me when "undo" in the file tree has not.
Super easy, and has saved me from despair.
@hkkcngz
hkkcngz / table.js
Created October 3, 2023 09:49
auto add html table role parameters for semantic code.
function AddTableARIA() {
try {
var allTables = document.querySelectorAll('table');
for (var i = 0; i < allTables.length; i++) {
allTables[i].setAttribute('role','table');
}
var allCaptions = document.querySelectorAll('caption');
for (var i = 0; i < allCaptions.length; i++) {
allCaptions[i].setAttribute('role','caption');
}
@hkkcngz
hkkcngz / style.css
Created September 4, 2023 19:52
3 Column Flex Image Gallery With Lightbox
<div class="container-all read-more-wrap mx-1">
<div class="containered ${clssName}">
<a class="example-image-link" href="${image}" data-lightbox="${title}" data-title="${bigTitle}">
<img src="${image}" loading="lazy" alt="${bigDesc}">
</a>
<span class="title">${bigTitle}</span>
<span class="text">${bigDesc}</span>
</div>
</div>
@hkkcngz
hkkcngz / index.html
Created September 4, 2023 19:50
Read More Elements Just Pure CSS
<input type="checkbox" class="read-more-state" id="el-1" />
<div class="read-more-wrap">
${ALLINONEPROJECTS}
</div>
<label for="homeprojects" class="read-more-trigger"></label>