Skip to content

Instantly share code, notes, and snippets.

View zo0m's full-sized avatar

Igor Kalashnikov zo0m

  • Full Stack Developer
  • Odessa
View GitHub Profile
(async function(){
const shareExecution = (callback) => {
let loading;
return async function () {
if (!loading) {
loading = callback();
loading.finally(() => loading = null)
}
@zo0m
zo0m / $NAME_$NAME.js
Created March 8, 2024 07:26
Webstorm File Template for Titanium component
#set($fileName = $NAME)
#set($className = ${StringUtils.removeAndHump($fileName.replaceAll("\W", "_"))})
#set($entityName = $className.substring(0, 1).toLowerCase() + $className.substring(1))
const {logDebug, logInfo, logError} = require("/app/utils");
const componentName = '${className}';
@zo0m
zo0m / alloy.jmk
Last active February 13, 2024 17:41
replace Ti.UI.createWindow with (require("/app/ui/kit").createWindow || Ti.UI.createWindow)
var sourceMapper = require('./sourceMapper');
var logger;
function log(message) {
if (logger) {
logger.info(`[fc][alloy.jmk]: ${message}`);
}
}
@zo0m
zo0m / EventList.js
Created May 12, 2020 12:23
Appcelerator Titanium Android ListView access via Hyperloop
const ListView = require('android.widget.ListView');
const View = require('android.view.View');
const ViewGroup = require('android.view.ViewGroup');
(function (tiList) {
const listWrapper = new View(tiList);
const nativeListView = ViewGroup.cast(listWrapper).getChildAt(1);
const list = ListView.cast(nativeListView);
list.smoothScrollToPositionFromTop((itemIndex + 1 /* 1st section*/), 0, 100);
@zo0m
zo0m / sqliteBridgeBottleneckTest.js
Last active April 7, 2020 09:42
Description bridge issue in SQLite implementation https://jira.appcelerator.org/browse/TIMOB-12291
// https://jira.appcelerator.org/browse/TIMOB-12291
/*
[DEBUG] sqliteBridgeBottleneckTest.compareQueries() start
[DEBUG] testCommonWay() start
[DEBUG] testCommonWay() loop:100 complete in 5087 ms
[DEBUG] testGroupConcat() start
[DEBUG] testGroupConcat() loop:100 complete in 844 ms
[DEBUG] testRs2JSON() start
[DEBUG] testRs2JSON() loop:100 complete in 3253 ms
@zo0m
zo0m / sqliteBridgeBottleneckTest.js
Created April 3, 2020 14:20
Description bridge issue in SQLite implementation
exports.compareQueries = function () {
testCommonWay();
testGroupConcat();
};
const TEST_QUERY_EXEC_COUNT = 50;
function testCommonWay() {
const startTime = new Date();
Ti.API.debug(`testCommonWay() start`);
@zo0m
zo0m / EventImage
Created April 2, 2020 12:44
Alloy bind_ attribute
Alloy
Require(src='components/common/base-window/BaseWindow')
Require#loader(src="components/common/horizontal-scroller/LoadingContainer")
Require#eventMap(src="components/event/map/EventMap", bind_onLoad="(()=> $.loader.onload())")
@zo0m
zo0m / Components.js
Last active September 19, 2019 14:21
Custom tags in go-od
const createFunctionsSet = {};
function buildCreatorFor(tagName, controllerName) {
const createFuntionName = `create${tagName}`;
createFunctionsSet[createFuntionName] = function (args) {
return Alloy.createController(controllerName, args).getView();
}
}
buildCreatorFor('BaseWindow', 'components/common/base-window/BaseWindow');
const moment = require('moment');
const Promise = require('bluebird');
const _ = require('underscore');
const {Logger} = require('../logger');
const translator = require('./translators');
let translationQueue = [];
let isProcessing = false;
@zo0m
zo0m / Singleton.js
Last active May 3, 2019 17:26
JavaScript ES6 Class Singleton
(function(){
class A {
static getInstance() {
if (!this.hasOwnProperty('_instance')) {
this._instance = new this;
console.log(`new instance of ${this._instance}`);
}
return this._instance;
}