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; | |
var aud = "Custom"; | |
var masterKey = "<your-master-key>"; | |
function insert(item, user, request) { | |
var accounts = tables.getTable('accounts'); | |
if (request.parameters.login) { | |
// this is a login attempt |
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 fs = require('fs'); | |
var assert = require('assert'); | |
var tables = require('./mockTable.js'); | |
// read the insert function ready for testing | |
eval(fs.readFileSync("./table/accounts.insert.js", "utf8")); | |
suite('accounts tables', function() { | |
test('insert hashing and creating salt', function(done) { | |
var testUsername = "testusername"; |
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 backup() { | |
var request = require('request'); | |
var util = require('util'); | |
var date = new Date(); | |
var year = date.getUTCFullYear(); | |
var month = date.getUTCMonth() + 1; | |
var day = date.getUTCDate(); | |
var body = { |
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 read(query, user, request) { | |
var dispatch = { | |
op1 : operation1, | |
op2 : operation2, | |
} | |
if (request.parameters.operation && dispatch.hasOwnProperty(request.parameters.operation)) { | |
dispatch[request.parameters.operation](query, user, request); | |
return; |
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 accountName = '<YOUR STORAGE ACCOUNT NAME HERE>'; | |
var accountKey = '<YOUR STORAGE ACCOUNT KEY HERE>'; | |
var azure = require('azure'); | |
var blobService = azure.createBlobService(accountName, accountKey); | |
function pulling() { | |
var xml = '<tile>' + | |
'<visual>' + | |
'<binding template="TileSquarePeekImageAndText01">' + | |
'<text id="1">' + new Date().toString() + '</text>' + |
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
- (void)handleRequest:(NSURLRequest *)request | |
next:(MSFilterNextBlock)next | |
response:(MSFilterResponseBlock)response | |
{ | |
// A wrapped response block that decrements the busy counter | |
MSFilterResponseBlock wrappedResponse = ^(NSHTTPURLResponse *innerResponse, NSData *data, NSError *error) { | |
response(innerResponse, data, error); | |
}; | |
// add additional versioning information to the querystring for versioning purposes |
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
// this is from the client code - simply pass the transactionReceipt property of the SKPaymentTransaction | |
// as the receipt parameter to the method below. This will POST the data to the mobile service which will, | |
// in turn, invoke the insert function on the server shown in this gist | |
- (void)insertReceipt:(NSData *)receipt completion:(CompletionBlock)completion | |
{ | |
NSString *string = [[NSString alloc] initWithData:receipt encoding:NSUTF8StringEncoding]; | |
[self.receipts insert:@{ @"receipt" : string } completion:^(NSDictionary *item, NSError *error) { | |
completion(); | |
}]; | |
} |
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
- (void)loadProducts:(QSCompletionBlock)completion; |
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
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response | |
{ | |
self.products = response.products; | |
// callback on the completion block | |
self.loadProductsComplete(); | |
} | |
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions | |
{ | |
// We'll add code here later |
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
- (void)viewDidAppear:(BOOL)animated | |
{ | |
MSClient *client = self.todoService.client; | |
if (client.currentUser != nil) { | |
return; | |
} | |
[client loginWithProvider:@"twitter" controller:self animated:YES completion:^(MSUser *user, NSError *error) { | |
[self.todoService loadProducts:^{ |