Skip to content

Instantly share code, notes, and snippets.

@alexkuc
alexkuc / rtl.scss
Last active June 29, 2022 09:38
RTL utility mixin
@mixin ltr {
html[dir='ltr'] &,
html:not([dir]) & {
@content;
}
}
@mixin rtl {
html[dir='rtl'] & {
@content;
@alexkuc
alexkuc / create-script.sh
Created June 22, 2022 07:26
Create distributable version of WordPress plugin
#!/usr/bin/env bash
# install node dependencies
# --production flag is *not* required since we use bundler
NODE_ENV=production npm install
# install optimized backend dependencies
composer install --no-dev --optimize-autoloader
# ensure clean dist directory
@alexkuc
alexkuc / git-rebase-keep-dates.sh
Last active June 18, 2020 17:44
After doing a rebase, apply git filter-branch to keep original committer/author dates
# Very important assumption: you have commit messages with _unique_ subject lines ('%s')
# If not, you need to either modify my gist or "go back to the drawing" board…
# Use these to check if you have unique subject lines or not:
# (the numbers must be identical)
export BRANCH=master
export OLD_BRANCH=old_branch
git log --format="%s" "$BRANCH" | uniq | wc -l | xargs
git log --oneline "$BRANCH" | wc -l | xargs
@alexkuc
alexkuc / tasks.js
Created April 30, 2020 22:11
Open Trello card, hover over task item, press shift+F1… Now your task's text is copied to clipboard!
// I have used this script with Tampermonkey to automatically inject it
const $ = window.$;
window.task = '';
const bind = () => {
$('.checklist-item-details-text').each( (i, el) => {
if ( el.classList.contains('mouseenter-event') ) { return };
$(el).mouseenter( e => { window.task = e.currentTarget.innerText } );
@alexkuc
alexkuc / tasks.js
Created April 30, 2020 18:39
Extract completed tasks from open Trello card using JavaScript and jQuery
const tasks = () => {
let tasks = ``;
// eslint-disable-next-line
$.each( $('.checklist-item-state-complete'), (i, val) => { // jQuery is already loaded by Trello
const task = $(val).find('.js-checkitem-name').text(); // eslint-disable-line
tasks = `${tasks}\n${task}`;
});
tasks = `${tasks}\n`;
return tasks;
};