Skip to content

Instantly share code, notes, and snippets.

@alexkuc
alexkuc / tasks.js
Created Apr 30, 2020
Extract completed tasks from open Trello card using JavaScript and jQuery
View tasks.js
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;
};
@alexkuc
alexkuc / tasks.js
Created Apr 30, 2020
Open Trello card, hover over task item, press shift+F1… Now your task's text is copied to clipboard!
View tasks.js
// 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 / git-rebase-keep-dates.sh
Last active Jun 18, 2020
After doing a rebase, apply git filter-branch to keep original committer/author dates
View git-rebase-keep-dates.sh
# 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 / create-script.sh
Created Jun 22, 2022
Create distributable version of WordPress plugin
View create-script.sh
#!/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 / rtl.scss
Last active Jun 29, 2022
RTL utility mixin
View rtl.scss
@mixin ltr {
html[dir='ltr'] &,
html:not([dir]) & {
@content;
}
}
@mixin rtl {
html[dir='rtl'] & {
@content;