Skip to content

Instantly share code, notes, and snippets.

View malipetek's full-sized avatar
🏠
Working from home

muhammet ali petek malipetek

🏠
Working from home
View GitHub Profile
### Tailwindcss V4
**Tailwind CSS Cheat Sheet**
Theming without config.js: Tailwind v4.0 allows direct CSS customization. Variables can be declared within your css files and used. For example, you can declare color variables in your main css file, and then use them within your tailwind classes. This allows for css first configuration.
**Core Concepts:**
* **Utility-First:** Class-based styling.
* **Responsive:** Breakpoint prefixes (sm:, md:, lg:, xl:, 2xl:).
* **Dark Mode:** `dark:` prefix.
{
"YSETCOLI": "YSETCONSES",
"YSETCODD": "YSETCONSES",
"YSETCOBB": "YSETCOJSES",
"YSETCOFF": "YSETCOJSES",
"YSETCOLF": "YSETCOJSES",
"YSETCOFL": "YSETCOJSES",
"YSETCOQV": "YSETCOJSES",
"YSETCOTX": "YSETCOJSES",
"COPA": "YSETCOJSES",
@malipetek
malipetek / translate.svg
Created December 9, 2023 07:40
translatesvg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Convert this script from jquery to vanilla js. Be careful about null scenarios, for example when you convert $('.class').show() to document.querySelector('.class').style.display = 'block' keep in mind result of querySelector might be null. I solve this issue like this: (document.querySelector('.class') || { style: {}}).style.display = 'block'
Also use fetch and es6 as much as you can.
Do not make any explanations, only try to convert and comment the parts you think can not be converted easily.
Here is the script:
(() => {
Array.from(document.querySelectorAll('.description textarea')).forEach(tx => {
tx.value = tx.value.replace(/(.+)petek:(.+)/, '$2 $1petek')
.replace(/^\s*([^\[\s]+)\s/, '[$1] ');
});
const spaces = {};
let total = 0;
Array.from(document.querySelectorAll('#invoice_item_rows>tr')).forEach(row => {
const description = row.querySelector('textarea').value;
const identifier = description.match(/\[[^\]]+\]/)[0].split('-')[0].replace('[', '');
@malipetek
malipetek / CHATEAU_MEAUME.sol
Created November 30, 2022 07:52
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.17+commit.8df45f5f.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/[email protected]/token/ERC721/ERC721.sol";
import "@openzeppelin/[email protected]/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/[email protected]/security/Pausable.sol";
import "@openzeppelin/[email protected]/access/Ownable.sol";
import "@openzeppelin/[email protected]/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/[email protected]/utils/Counters.sol";
import "@openzeppelin/[email protected]/token/ERC721/extensions/ERC721URIStorage.sol";
@malipetek
malipetek / video_overlay.css
Created November 1, 2022 19:05
Video overlay for hiding pixelation on webpages
video-container {
position: relative;
}
.video-container:after {
display: block;
content: '';
position: absolute;
width: 100%;
height: 100%;
top: 0;
@malipetek
malipetek / turkishStemmer.js
Created May 18, 2022 02:06
Turkish Stemmer extracted from snowballstem.org demo
window.turkishStemmer = function() {
var g = true;
var p = false;
function C() {
this.p = function(k) {
this.j = k;
this.cursor = 0;
this.a = this.j.length;
this.f = 0;
@malipetek
malipetek / JSONparse.js
Last active March 11, 2022 03:40
JSON parse with error visualization
function JSONparse (content) {
try{
return JSON.parse(content);
} catch (err) {
try {
const offset = parseInt(err.message.match(/position\s+(\d+)/)[1], 10);
const linesUntilError = content.slice(0, offset + 1).split('\n');
const errorLine = linesUntilError.length;
const contentLines = content.split('\n');
const lineOffset = linesUntilError[linesUntilError.length - 1].length - 1;
@malipetek
malipetek / prune-shopify-schema.md
Last active September 27, 2021 13:40
multi language schema is great but my client does not need it, I wanted to remove it to declutter section schema

open vscode paste following to find and replace, enable regexp and execute replace all, then execute second one

find: "(name|label|default|category)":\s\{\n(\s*"(?!en).+":\s*".+",?)+

replace: "$1": {

find: