Skip to content

Instantly share code, notes, and snippets.

View umkasanki's full-sized avatar

Oleg Tishkin umkasanki

View GitHub Profile
@umkasanki
umkasanki / ckeditor.json
Created February 19, 2024 07:34
craftcms. ckeditor config sample
{
"code": {
"indentSequence": " "
},
"heading": {
"options": [
{
"class": "ck-heading_heading1",
"model": "heading1",
"title": "Heading 1",
@umkasanki
umkasanki / gist:8709d8ec1cb37c2ddf984a59718e275b
Created August 30, 2023 12:03
CraftSMS + Sprig. Entries filter sample
parent template:
<h1>Filter</h1>
<hr>
{{ sprig('_inc/filter', {'limit': 3}) }}
{{ sprig.script }}
Child template:
{% set page = page ?? 1 %}
@umkasanki
umkasanki / anim.css
Created June 15, 2021 08:27
Figma scroll animation
.onboarding--inner--VHh_M {
height: auto;
animation: onboarding--scrolly--1DurJ 120s infinite;
animation-name: onboarding--scrolly--1DurJ;
animation-duration: 120s;
animation-timing-function: ease;
animation-delay: 0s;
animation-iteration-count: infinite;
animation-direction: normal;
animation-fill-mode: none;
@umkasanki
umkasanki / categories.twig
Created May 28, 2021 14:59
Craft CMS. Categories tree
<div>
{% for category in craft.categories.all() %}
{% if category.level == 1 %}
{% set children = category.getChildren() %}
<h4>{{ category.title }}</h4>
{% if children|length %}
<ul>
{% for subcategory in children %}
<li>{{ subcategory.title }}</li>
@umkasanki
umkasanki / gist:57e2c809c207941bf2e532c8d4a97654
Last active December 6, 2020 17:27
m201130_141427_truncate_formie_tables.php
<?php
namespace craft\contentmigrations;
use Craft;
use craft\db\Migration;
use craft\elements\SentNotification;
use craft\helpers\FileHelper;
use craft\helpers\Json;
use craft\helpers\MigrationHelper;
@umkasanki
umkasanki / gist:253c23fd17f0f75d3e7ce125c5dcb7d6
Created November 28, 2020 08:35
Bash. Change filename of multiple files
find . -name '*.pcss' -exec sh -c 'mv "$0" "${0%.pcss}.scss"' {} \;
@umkasanki
umkasanki / change.js
Created September 9, 2020 13:29
change video speed
var vid = document.getElementById("video1");
function slowPlaySpeed() {
vid.playbackRate = 0.5;
}
function normalPlaySpeed() {
vid.playbackRate = 1;
}
@umkasanki
umkasanki / remove-from-git.md
Last active May 3, 2020 05:59
Remove Files completely from git repository history

git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch path_to_file" HEAD

git push --force

@umkasanki
umkasanki / fetch.js
Last active May 1, 2020 10:17
fetch data from one or multiple urls
// store urls to fetch in an array
const urls = [
'/ajax/getLanguagesRate?sourceLang=arabic&targetLang=albanian',
'/ajax/getLanguagesRate?sourceLang=arabic&targetLang=afrikaans',
'/ajax/getSubjectRate?subject=legal',
'/ajax/getDeliveryRate?delivery=standart',
];
// from multiple urls
Promise.all(urls.map((url) => fetch(url)))
@umkasanki
umkasanki / checkVisability.js
Created March 25, 2020 05:31
Intersection Observer for check position of element
const checkVisability = target => {
const io = new IntersectionObserver((entries, observer) => {
console.log(entries)
entries.forEach(entry => {
if (entry.isIntersecting) {
console.log('visible');
// observer.disconnect();
} else {