Skip to content

Instantly share code, notes, and snippets.

View soulfly's full-sized avatar

Mr. software craftsman soulfly

View GitHub Profile
2014-07-08 12:20:42.417 Snippets[19144:1303] -[QBChat xmppStream:didSendIQ:] -> IQ: <iq type="get" to="muc.chat.quickblox.com" id="5610027"><query xmlns="http://jabber.org/protocol/disco#items"></query></iq>
2014-07-08 12:20:46.384 Snippets[19144:1303] -[QBChat xmppStream:didReceiveIQ:] -> <iq xmlns="jabber:client" from="muc.chat.quickblox.com" to="[email protected]/89DD494C-5D34-4590-9F9A-A08E817E0056" type="result" id="5610027"><query xmlns="http://jabber.org/protocol/disco#items"><item name="prod_2rrvthnzxz_2rrvtho2gh" jid="[email protected]"></item><item name="prod_2rrvthnz5c_2rrvtho2b5" jid="[email protected]"></item><item name="prod_2rrvthnzn2_2rrvtho11s" jid="[email protected]"></item><item name="prod_2rrvtho1xq_2rrvtho24l" jid="[email protected]"></item><item name="prod_2rrvtho2mv_2rrvtho47d" jid="[email protected]
@soulfly
soulfly / Swift singleton implementation
Last active August 29, 2015 14:02
Swift singleton implementation
var myInstance:ChatService?
class ChatService {
class func instance() -> ChatService{
if !myInstance {
myInstance = ChatService()
println("init")
}
@soulfly
soulfly / Chat MUC xmpp4r: add affilations
Created June 2, 2014 08:15
Chat MUC xmpp4r: add affilations
require 'xmpp4r/client'
require 'xmpp4r/muc'
puts "1"
client = Jabber::Client.new(Jabber::JID::new("[email protected]"))
client.connect
puts "2"
client.auth("emmaemma")
<iq xmlns="jabber:client" id="561004347" from="[email protected]" to="[email protected]" type="result"><query xmlns="http://jabber.org/protocol/disco#info"><identity name="Test Room Test" category="conference" type="text"></identity><feature var="http://jabber.org/protocol/muc"></feature><feature var="muc_semianonymous"></feature><feature var="muc_unmoderated"></feature><feature var="muc_open"></feature><feature var="muc_persistent"></feature><feature var="muc_public"></feature><feature var="muc_unsecured"></feature></query></iq>
<iq type="get" to="[email protected]" id="561004347" from="[email protected]"><query xmlns="http://jabber.org/protocol/disco#info"></query></iq>
<iq id="[email protected]" to="[email protected]" type="set"><query xmlns="http://jabber.org/protocol/muc#owner"><x xmlns="jabber:x:data" type="submit"><field var="muc#roomconfig_roomname"><value>Test Room Test</value></field><field var="muc#roomconfig_persistentroom"><value>1</value></field></x></query></iq
QBUser participant = new QBUser(2);
QBPrivateChatManager manager = QBChatService.getInstance().getPrivateChatManager();
manager.addChatListener(new QBChatManagerListener() {
@Override
public void chatCreated(QBChat chat) {
}
@soulfly
soulfly / gist:7640054
Last active December 29, 2015 07:59
rooms
<iq type="result" id="561002161" xmlns="jabber:client" to="[email protected]" from="muc.chat.quickblox.com">
<query xmlns="http://jabber.org/protocol/disco#items">
<item jid="[email protected]" name="TestFlight time"/>
<item jid="[email protected]" name="Does this work?"/>
<item jid="4679_not_literlly,[email protected]" name="Not literlly, it delted"/>
<item jid="[email protected]" name="Chattin like a mofo"/>
<item jid="[email protected]" name="Pool"/>
<item jid="[email protected]" name="Jsnsnndjdnd"/>
<item jid="[email protected]" name="Testing a yapp"/>
<item jid="[email protected]" name="Rife high"/>
- (void) captureStillImage
{
AVCaptureConnection *stillImageConnection = [AVCamUtilities connectionWithMediaType:AVMediaTypeVideo fromConnections:[[self stillImageOutput] connections]];
if ([stillImageConnection isVideoOrientationSupported])
[stillImageConnection setVideoOrientation:orientation];
[[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:stillImageConnection
completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {
ALAssetsLibraryWriteImageCompletionBlock completionBlock = ^(NSURL *assetURL, NSError *error) {
def update_record
json_data = JSON.parse(params["record"]["json_body"])
data = CustomData.where(:id => params["record"]["id"], :application_id => @current_app.id).first
authorize! :update, data
data.update_attributes typify_hash(json_data)
if json_data["user_id"] != data.user_id
begin
user = User.find(json_data["user_id"].to_i)
data.user_id = user.id if (user.account_id == @current_user.account_id)