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).
*/
@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();
@hkkcngz
hkkcngz / Errors.java
Created January 27, 2023 09:39 — forked from bhnascar/Errors.java
Error spotting practice
import java.util.*;
class Errors
{
/* Adds the given value to everything in the ArrayList.
*
* This AddToAll method does not work correctly. Explain
* why.
*
* Which of the following replacements for line 19 will fix the method?
@hkkcngz
hkkcngz / InheritancePractice.java
Created January 27, 2023 09:39 — forked from bhnascar/InheritancePractice.java
Inheritance practice questions
class InheritancePractice
{
public static abstract class Vehicle
{
public int maxSpeed; // In MPH
public int acceleration; // In 0-60MPH secs
public Vehicle(int maxSpeed, int acceleration) {
this.maxSpeed = maxSpeed;
this.acceleration = acceleration;