Skip to content

Instantly share code, notes, and snippets.

Avatar

Łukasz Janyga lukaszjanyga

  • Shipt
View GitHub Profile
@lukaszjanyga
lukaszjanyga / auth.js
Last active Mar 16, 2018
Simple redis cache
View auth.js
async function getAuthResponse(req) {
let serviceRes = await cacheController.getCachedCustomerAuth(req.headers.authorization);
if (serviceRes === null) {
serviceRes = await CustomerService.isAuthenticated(req);
cacheController.cacheCustomerAuth(req.headers.authorization, serviceRes);
}
return serviceRes;
}
View app.js
config.init(CONFIG_FILE)
.then(() => {
config.config.bodyParser = require('./config/upload_config');
return hydraExpress.init(config.getObject(), version, onRegisterRoutes, onRegisterMiddleware);
})
@lukaszjanyga
lukaszjanyga / PObjectToJsonParser
Last active Aug 29, 2015
Parser converts any ParseObject to JSONObject or JSONString and vice versa. * Reflection is used for maintaining type compatibility. * Each ParseObject property value is stored as JSONArray [type, value] under given key. * Created by Łukasz Janyga on 2015-07-07.
View PObjectToJsonParser
/**
* Parser converts any ParseObject to JSONObject or JSONString and vice versa.
* Reflection is used for maintaining type compatibility.
* Each ParseObject property value is stored as JSONArray [type, value] under given key.
* Created by Łukasz Janyga on 2015-07-07.
*/
public class PObjectToJsonParser {
public static JSONObject toJsonObject(ParseObject parseObject) {
JSONObject jsonObject = new JSONObject();
You can’t perform that action at this time.