Skip to content

Instantly share code, notes, and snippets.

View falkolab's full-sized avatar
🏠
Working from home

Andrey Tkachenko falkolab

🏠
Working from home
  • Russian Federation
View GitHub Profile
@falkolab
falkolab / base.js
Last active September 4, 2015 13:31
View proxy remain in memory after window closed. https://yadi.sk/i/jmtrY-I0isR3g
exports.setMenuItemEnabled = function(menuItem, isEnabled) {
if(OS_ANDROID) {
if(Alloy.Globals.isAndroid3Plus && menuItem.actionView) {
menuItem.actionView.touchEnabled = isEnabled;
}
menuItem.setEnabled(isEnabled);
}
};
@falkolab
falkolab / TelephonyInfoProxy.java
Last active September 11, 2017 12:16
Titanium android module proxy to check whether the phone is dual SIM
// http://stackoverflow.com/a/17499889/506724
package com.falkolab.drunkmode.platform;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Method;
import java.util.ArrayList;
import org.appcelerator.kroll.KrollProxy;
@falkolab
falkolab / alloy.js
Last active August 29, 2015 14:10
TIMOB-18128 monkey patch
var patches = require('patches');
patches.fix_displayCaps();
@falkolab
falkolab / findViews.js
Created September 2, 2014 13:57
Find views in view hierarchy that corresponded specified properties. Titanium Alloy.
var findViews = function(where, props, deep) {
var ctl = _.where(where.children, props);
if(deep){
return _.reduce(where.children, function(memo, view) {
return memo.concat(findViews(view, props, true));
}, ctl);
} else {
return ctl;
}
};
@falkolab
falkolab / download.js
Created July 30, 2014 08:16
Download file by http with progress (NodeJS)
function download(fileUrl, apiPath, callback) {
var url = require('url'),
http = require('http'),
p = url.parse(fileUrl),
timeout = 10000;
var file = fs.createWriteStream(apiPath);
var timeout_wrapper = function( req ) {
return function() {