Skip to content

Instantly share code, notes, and snippets.

View soulfly's full-sized avatar

Mr. software craftsman soulfly

View GitHub Profile
iceState: function(iceConnectionState){
if (iceConnectionState == "failed"){
restartLocalPeerConnection();
}
}
...
function restartLocalPeerConnection(){
switchVideoDevice(userVideoinputDevices[0].deviceId);
switchVideoinput: function(mediaDeviceId, callbacks){
// stop & close previous local peer
this.videoRoomPlugin.hangup(true);
// request new stream
var constraints = {
audio: true,
video: {deviceId: {exact: mediaDeviceId}}
};
class User < ApplicationRecord
validates :login, presence: true, uniqueness: true
end
class CreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
t.string :login
t.string :full_name
package com.quickblox.chat.model;
import android.text.TextUtils;
import com.quickblox.chat.propertyparsers.MessagePropertyParser;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.util.XmlStringBuilder;
# Get valid JWT public keys and save to cache
#
# Must correspond to one of the public keys listed at
# https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com
#
valid_public_keys = Rails.cache.read(VALID_JWT_PUBLIC_KEYS_RESPONSE_CACHE_KEY)
if valid_public_keys.nil?
uri = URI("https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com")
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
Thread Name: jp@gc - Stepping Thread Group 1-1
Sample Start: 2017-04-28 16:16:58 BST
Load time: 21000
Connect Time: 0
Latency: 0
Size in bytes: 773
Headers size in bytes: 0
Body size in bytes: 773
Sample Count: 1
Error Count: 1
@soulfly
soulfly / gist:fe7a2d4ac0a6125cbf151c2eaa7c4b2c
Last active February 21, 2017 09:18
QM_Android_crash_startapp
02-21 11:18:00.684 18925-18925/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.quickblox.q_municate, PID: 18925
java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.Collection.isEmpty()' on a null object reference
at com.quickblox.q_municate_core.utils.ChatNotificationUtils.parseDialogFromQBMessage(ChatNotificationUtils.java:68)
at com.quickblox.q_municate_core.qb.helpers.QBChatHelper.onChatMessageReceived(QBChatHelper.java:673)
at com.quickblox.q_municate_core.qb.helpers.QBChatHelper.access$600(QBChatHelper.java:63)
at com.quickblox.q_municate_core.qb.helpers.QBChatHelper$AllChatMessagesListener.processMessage(QBChatHelper.java:740)
@soulfly
soulfly / validatesessiontoken.java
Last active February 6, 2017 10:48
validate session token
String token = BaseService.getBaseService().getToken();
Date expirationDate = BaseService.getBaseService().getTokenExpirationDate();
// save to secure storage when your application goes offline or to the background
...
// recreate session on next start app
Date currentDate = new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(currentDate);
{
"session_id": 4947315360452683,
"session_last_activity": 253731743098,
"session_transport": "janus.transport.websockets",
"handle_id": 3861225917609465,
"created": 253271067295,
"send_thread_created": true,
"current_time": 253737709272,
"plugin": "janus.plugin.videoroom",
"plugin_specific": {
{
"session_id": 4947315360452683,
"session_last_activity": 253454782634,
"session_transport": "janus.transport.websockets",
"handle_id": 7530704458089235,
"created": 253312809178,
"send_thread_created": true,
"current_time": 253456828153,
"plugin": "janus.plugin.videoroom",
"plugin_specific": {