Skip to content

Instantly share code, notes, and snippets.

View dejurin's full-sized avatar
💭
;-)

YURII D. dejurin

💭
;-)
  • Si-ɑR
  • București, România 🇷🇴
  • 09:09 (UTC +03:00)
View GitHub Profile
@dejurin
dejurin / create_archive.sh
Created April 19, 2024 14:13
This script creates a zip archive of the current directory, excluding files starting with '.DS_', and names the archive after the current directory.
#!/bin/bash
# Script: create_archive.sh
# Description: This script creates a zip archive of the current directory, excluding files starting with '.DS_', and names the archive after the current directory.
# Assign the name of the current directory to the variable 'folder_name'
folder_name=$(basename "$PWD")
# Find files in the current directory and its subdirectories, excluding those whose names start with '.DS_', and zip them into an archive named after the current directory
find . -type f -not -name '.DS_*' -exec zip "$folder_name.zip" {} +
@dejurin
dejurin / bad-words.txt
Created March 26, 2024 21:16
Bad words (stop words)
bi
fu
ho
ky
uk
wn
xx
ass
bbw
nig
// https://jsfiddle.net/v8Lxazhr/
function changeValue(isIncreasing) {
const valueElement = document.getElementById('valueElement');
let currentValue = parseInt(valueElement.innerText);
if (isIncreasing) {
currentValue++;
valueElement.style.color = 'green';
} else {
@dejurin
dejurin / polymorphic.ts
Last active March 8, 2024 13:51
Qwik Polymorphic Component Example
import type { QwikIntrinsicElements } from "@builder.io/qwik";
import { component$, Slot } from "@builder.io/qwik";
export default component$(
<C extends keyof QwikIntrinsicElements>(props: PolyProps<C>) => {
const Component = (props.as ?? "div") as string;
return (
<Component {...props}>
<Slot />
</Component>
@dejurin
dejurin / generateMonthCalendar.ts
Created February 27, 2024 21:51
Generate Month Calendar by Luxon
import { Info, DateTime } from "luxon";
function generateMonthCalendar(dt: DateTime, locale = "en-US") {
const startOfMonth = dt.startOf("month");
// Prepare an array to fill in the calendar
const calendar = [];
for (let i = 0; i < startOfMonth.weekday - 1; i++) {
calendar.push(" ");
}
@dejurin
dejurin / useOnDocument.ts
Created February 27, 2024 09:30
useOnDocument
useOnDocument(
"readystatechange",
$(() => {
const id = setInterval(() => {
isMounted.value = true;
const dt = getTimeLuxon({ timeZone, locale: "en-US" });
stateTime.value = noSerialize(dt) as DateTime & {
__no_serialize__: true;
};
}, 1000);
@dejurin
dejurin / filterDataByKey2D.ts
Last active February 25, 2024 12:07
Filters a 2D array of data objects by a keyword.
/*
That function make filter by this map.
[
{
"si": [
{
"millimeter": "0.001"
}
]
@dejurin
dejurin / qwikSerialized.js
Created February 19, 2024 16:11
Qwik Serialized
import { componentQrl, qrl } from "@builder.io/qwik";
export const qwikSerialized = (dynamicImport, fn = "default") => {
return componentQrl(qrl(dynamicImport, fn));
}
/*
import Stats from "~/components/widgets/Stats";
import CallToAction from "~/components/widgets/CallToAction";
import { qwikSerialized } from "~/utils/qwikSerialized";
@dejurin
dejurin / locales.ts
Created January 7, 2024 10:00
Chrome Extensions: List of languages supported by chrome.i18n as an array-object.
/*
Locales
You can choose from many locales, including some (such as en) that let a single translation support multiple variations of a language (such as en_GB and en_US).
You can localize your extension to any locale that is supported by the Chrome Web Store. If your locale is not listed here, choose the closest alternative. For example, if the default locale of your extension is "de_CH", choose "de" in the Chrome Web Store.
*/
const locales: { label: string; value: string }[] = [
{ label: "العربية", value: "ar" },
import os
import requests
import json
import re
from slugify import slugify
EMOJI_VERSION = '15.1'
def main():
text = get_test_file(EMOJI_VERSION)