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 / 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>
@hkkcngz
hkkcngz / bootstrap-table-generator.php
Created August 31, 2023 06:12
Bootstrap-table Generator
function generateBootstrapTable($id, $columns, $dataUrl, $extensions = []) {
$tableHtml = "<table id='$id' class='table table-striped'";
// Temel ayarlar
$tableHtml .= ' data-id-field="id" data-unique-id="id" data-toolbar="#toolbar"';
// Eklentileri ve özellikleri ekleyin
foreach($extensions as $key => $value) {
$tableHtml .= ' data-' . $key . '="' . $value . '"';
}
@hkkcngz
hkkcngz / modalgenerator.php
Last active August 31, 2023 06:11
Bootstrap Modal Generator
function generateModal($modalId, $modalTitle, $fields, $extraHtml = "") {
$submitButtonId = $modalId . "Submit";
$submitButtonText = 'Kaydet';
$modal = '<div class="modal fade" id="' . $modalId . '" tabindex="-1" role="dialog" aria-labelledby="' . $modalId . 'Label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">' . $modalTitle . '</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Kapat">
@hkkcngz
hkkcngz / MoreArrayListTest.java
Created January 27, 2023 09:39 — forked from bhnascar/MoreArrayListTest.java
Tests for MoreArrayList
import java.util.*;
class MoreArrayListTest
{
public static void main(String[] args)
{
// Run all the tests.
testNormalize();
testShuffle();
testRemoveDuplicates();