This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// make query | |
long timestamp = System.currentTimeMillis()/1000; | |
int nonce = new Random().nextInt(); | |
String signatureParams = String.format("application_id=%s&auth_key=%s&nonce=%s×tamp=%s&user[login]=%s&user[password]=%s", | |
QBQueries.APPLICATION_ID, QBQueries.AUTH_KEY, nonce, timestamp, "test", "test"); | |
String signature = null; | |
try { | |
signature = Signature.calculateHMAC_SHA(signatureParams, QBQueries.AUTH_SECRET); | |
} catch (SignatureException e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TwitterAuthScreen extends MainScreen implements Constants | |
{ | |
private TwitterAuthScreen me; | |
private BrowserField browserField; | |
private ProtocolController protocolController; | |
private BrowserFieldErrorHandler browserFieldErrorHandler; | |
private BrowserFieldConfig browserFieldConfig = new BrowserFieldConfig(); | |
private String twitterCookie = ""; | |
private String twittwerAuthURL = ""; | |
private TwitterPoster twitterPoster = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TwitterQBAuth implements QBHTTPAnswerListener | |
{ | |
private String TOKEN = ""; | |
private String timestamp = ""; | |
private String BROWSER_SESSION = ""; | |
private String TWITTER_AUTH_URL = ""; | |
private final String QB_APP_ID = "341"; | |
private final String QB_AUTH_KEY = "nhsOHKDNqwvpuDV"; | |
private final String QB_AUTH_SECRET = "evPuQba3jC3Q6AX"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Post message to Twitter | |
*/ | |
private boolean postTwitt(UserAccountManager _userAccMan, String _message) { | |
try { | |
Tweet uT = new Tweet(_message); | |
TweetER tTR = TweetER.getInstance(_userAccMan); | |
tTR.post(uT); | |
return true; | |
} catch (IllegalArgumentException iAE) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QBAuth.createSession(new QBCallbackImpl() { | |
@Override | |
public void onComplete(Result result) { | |
// result comes here | |
// check if result success | |
if (result.isSuccess()) { | |
// do stuff you need | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QBUser participant = new QBUser(2); | |
QBPrivateChatManager manager = QBChatService.getInstance().getPrivateChatManager(); | |
manager.addChatListener(new QBChatManagerListener() { | |
@Override | |
public void chatCreated(QBChat chat) { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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 |