Skip to content

Instantly share code, notes, and snippets.

View soulfly's full-sized avatar

Mr. software craftsman soulfly

View GitHub Profile
@soulfly
soulfly / test.js
Created August 1, 2016 10:54
test js gist
require
@soulfly
soulfly / UIControl_CustomTouchTracker.m
Last active June 3, 2016 09:29
This UIControl extension blocks frequent touches
// Created at: Thursday, February 16, 2012 at 4:29 PM
// replace method util
static void MethodSwizzle(Class c, SEL orig, SEL new){
Method origMethod = class_getInstanceMethod(c, orig);
Method newMethod = class_getInstanceMethod(c, new);
if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))){
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
} else {
method_exchangeImplementations(origMethod, newMethod);
Feb 25 12:37:58 Igor-Khomenkos-iPhone networkd[100] <Notice>: -[NETAWDManager reportStats:metricID:] server 0x136655570, container 0x13652bee0, metrid 2686983, successfully reported:
<AWDLibnetcoreTCPConnectionReport: 0x13652a7c0> {
cellularFallbackReport = {
dataUsageSnapshotsAtNetworkEvents = (
{
bytesIn = 6600;
bytesOut = 3000;
}
);
"fallbackTimer_msecs" = 0;
C2S - RECV (1083417823): <?xml version='1.0'?>
C2S - RECV (1083417823): <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='chat.example.com'>
C2S - SENT (1083417823): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="chat.example.com" id="5a051bc8" xml:lang="en" version="1.0">
C2S - SENT (1083417823): <stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required/></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>DIGEST-MD5</mechanism></mechanisms></stream:features>
C2S - RECV (1083417823): <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
Starting Hazelcast Clustering Plugin
C2S - RECV (1083417823): <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='chat.example.com'>
C2S - SENT (1083417823): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/strea
02-01 18:00:28.858 25451-25679/com.quickblox.sample.content D/GalleryActivity: progress: 55
02-01 18:00:28.858 25451-25679/com.quickblox.sample.content D/GalleryActivity: progress: 56
02-01 18:00:28.866 25451-25679/com.quickblox.sample.content D/GalleryActivity: progress: 57
02-01 18:00:28.866 25451-25679/com.quickblox.sample.content D/GalleryActivity: progress: 58
02-01 18:00:28.866 25451-25679/com.quickblox.sample.content D/GalleryActivity: progress: 59
02-01 18:00:28.873 25451-25679/com.quickblox.sample.content D/GalleryActivity: progress: 60
02-01 18:00:28.873 25451-25679/com.quickblox.sample.content D/GalleryActivity: progress: 61
02-01 18:00:28.873 25451-25679/com.quickblox.sample.content D/GalleryActivity: progress: 62
02-01 18:00:28.873 25451-25679/com.quickblox.sample.content D/GalleryActivity: progress: 63
02-01 18:00:28.873 25451-25679/com.quickblox.sample.content D/GalleryActivity: progress: 64
01-29 16:40:04.722 13429-13994/com.sdk.snippets I/SnippetsContent: progress: 97
01-29 16:40:04.722 13429-13994/com.sdk.snippets I/SnippetsContent: progress: 99
01-29 16:40:04.730 13429-13994/com.sdk.snippets I/SnippetsContent: progress: 100
01-29 16:40:04.730 13429-13994/com.sdk.snippets W/System.err: java.io.EOFException
01-29 16:40:04.730 13429-13994/com.sdk.snippets W/System.err: at libcore.io.Streams.readAsciiLine(Streams.java:203)
01-29 16:40:04.730 13429-13994/com.sdk.snippets W/System.err: at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:579)
01-29 16:40:04.730 13429-13994/com.sdk.snippets W/System.err: at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:827)
01-29 16:40:04.737 13429-13994/com.sdk.snippets W/System.err: at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
01-29 16:40:04.737 13429-13994/com.sdk.snippets W/System.err: at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:497)
01-
@soulfly
soulfly / python_quickblox_xmpp_test_login.py
Created January 29, 2016 11:23
Python script to test duration time of XMPP login to QuickBlox Chat
import logging
import time
from sleekxmpp import ClientXMPP
class EchoBot(ClientXMPP):
def __init__(self, jid, password):
ClientXMPP.__init__(self, jid, password)
self.add_event_handler("session_start", self.session_start)
// init test user
final QBUser qbUser = new QBUser();
qbUser.setId(ApplicationConfig.getInstance().getTestUserId1());
qbUser.setPassword(ApplicationConfig.getInstance().getTestUserPassword1());
log("login with user: " + qbUser);
//
//
@soulfly
soulfly / python_gcm_sender.py
Created January 8, 2016 13:48
python_gcm_sender
from gcm import GCM
API_KEY = "..."
gcm = GCM(API_KEY)
data = {'param1': 'value1', 'param2': 'value2'}
# JSON request
reg_ids = ['...']
response = gcm.json_request(registration_ids=reg_ids, data=data)
@soulfly
soulfly / java
Last active October 22, 2015 08:59
final int fileId = 2641910;
QBContent.downloadFileTask(fileId, new QBEntityCallbackImpl<InputStream>(){
@Override
public void onSuccess(final InputStream inputStream, Bundle params) {
long length = params.getLong(Consts.CONTENT_LENGTH_TAG);
Log.i(TAG, "content.length: " + length);
Thread thread = new Thread() {