Skip to content

Instantly share code, notes, and snippets.

View kirill-konshin's full-sized avatar

Kirill Konshin kirill-konshin

View GitHub Profile
/**
* @author Jacky Nguyen
* @author Kirill Konshin (patched version for Sencha Touch 2.2.x)
* @class Common.MouseWheelDrag
*
* Ext.Loader.setPath('Common', '/path/to/your/app/common');
*
* Ext.application({
* // ...
* eventPublishers: {
@kirill-konshin
kirill-konshin / index.ts
Created May 7, 2020 18:31
Sequential promise-based batches for JavaScript or TypeScript
/**
* Task is just an async function that accepts no arguments and returns a promise with result
* Example: `async () => new Promise(...)`
*/
export const sequentialBatches = async <T>(tasks: (() => Promise<T>)[], maxConcurrency = 100): Promise<T[]> => {
const batches = tasks.reduce((res, task, index) => {
const batchIndex = Math.floor(index / maxConcurrency);
res[batchIndex] = res[batchIndex] || [];
res[batchIndex].push(task);
return res;
@kirill-konshin
kirill-konshin / Evict.workflow.js
Created March 11, 2023 08:18
Automator script to evict a folder from iCloud (using JXA)
const app = Application.currentApplication();
app.includeStandardAdditions = true;
function run(input, parameters) {
try {
if (input.length > 1) throw new Error('Has to be one folder');
let folder = input['0'].toString();
if (!folder) throw new Error('No folder');