This file contains hidden or 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
var crypto = require('crypto'); | |
var iterations = 1000; | |
var bytes = 32; | |
exports.createSalt = function() { | |
return new Buffer(crypto.randomBytes(bytes)).toString('base64'); | |
} | |
exports.hash = function hash(text, salt, callback) { | |
crypto.pbkdf2(text, salt, iterations, bytes, function(err, derivedKey){ |
This file contains hidden or 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
var mssql = request.service.mssql; | |
var sql = "UPDATE TableA SET valueOne = ? WHERE userId = ?;UPDATE TableB SET valueTwo = ? WHERE userId = ?;"; | |
mssql.queryRaw(sql, [item.valueOne, user.userId, item.valueTwo, user.userId], { | |
success: function(results) { | |
request.respond(200, { Status: 'SUCCESS', Details: 'Tables have been updated'}); | |
}, | |
error: function(error) { | |
console.error("Error updating tables: ", error); | |
request.respond(500, 'Error updating email address'); | |
} |
This file contains hidden or 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
Toast toast = Toast.makeText(this, "This is a toast that is centered onscreen and the text is centered in the toast", Toast.LENGTH_SHORT); | |
LinearLayout layout = (LinearLayout) toast.getView(); | |
TextView tv = (TextView) layout.getChildAt(0); | |
tv.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL); | |
toast.setGravity(Gravity.CENTER, 0, 0); | |
toast.show(); |
This file contains hidden or 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
Toast.makeText(this, "This is a toast that isn't centered in anyway at all", Toast.LENGTH_SHORT).show(); |
This file contains hidden or 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
<style name="ActionBarStyle" parent="android:style/Widget.Holo.Light.ActionBar"> | |
<item name="android:colorBackground">@color/dull_purple</item> | |
<item name="android:background">@color/dull_purple</item> | |
<item name="android:textColor">@android:color/white</item> | |
<item name="android:titleTextStyle">@style/TitleTextStyle</item> | |
</style> |
This file contains hidden or 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
function update(item, user, request) { | |
request.execute({ | |
success: function(){ | |
request.respond(); | |
sendNotifications(item); | |
}, | |
error: function(err){ | |
request.respond(500, "Error"); | |
} |
This file contains hidden or 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
exports.get = function(request, response) { | |
var redirectUrl = 'https://accounts.google.com/o/oauth2/auth?response_type=code&' + | |
'redirect_uri=http%3A%2F%2Fglasstest.azure-mobile.net%2Fapi%2Fglassauth&' + | |
'client_id=<Client ID>&' + | |
'scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fglass.timeline+' + | |
'https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fglass.location+' + | |
'https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&' + | |
'access_type=offline&approval_prompt=force'; | |
response.send(statusCodes.OK, | |
'<html><body><script type="text/javascript">(function() {window.location = "'+redirectUrl+ |
This file contains hidden or 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
gcm = GoogleCloudMessaging.getInstance(this); | |
String connectionString = "<Notification Hub Listen Access Connection String>"; | |
hub = new NotificationHub("<Notification Hub Name>", connectionString, this); | |
registerWithNotificationHubs(); |
This file contains hidden or 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
NSString *stringData = [[NSString alloc] initWithData:result encoding:NSUTF8StringEncoding]; |
This file contains hidden or 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
private class MyServiceFilter implements ServiceFilter { | |
@Override | |
public void handleRequest(final ServiceFilterRequest request, final NextServiceFilterCallback nextServiceFilterCallback, | |
final ServiceFilterResponseCallback responseCallback) { | |
nextServiceFilterCallback.onNext(request, new ServiceFilterResponseCallback() { | |
@Override | |
public void onResponse(ServiceFilterResponse response, Exception exception) { | |
StatusLine status = response.getStatus(); | |
int statusCode = status.getStatusCode(); |