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
{ | |
"AEAJM": { | |
"name": "Ajman", | |
"city": "Ajman", | |
"country": "United Arab Emirates", | |
"alias": [], | |
"regions": [], | |
"coordinates": [ | |
55.5136433, | |
25.4052165 |
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 Startup(IConfiguration configuration) | |
{ | |
Configuration = configuration; | |
StaticConfig = configuration; | |
} | |
public static IConfiguration Env { get; private set; } | |
// to use simply call the static member from anywher in the app | |
// Startup.Env["Jwt:issuer"] |
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
'use strict'; | |
module.exports = async function(createSequelizeInstance, log) { | |
const { Sequelize, Op, Model, DataTypes } = require('sequelize'); | |
const sequelize = createSequelizeInstance({ benchmark: true }); | |
await sequelize.authenticate(); | |
const Report = sequelize.define('Report', { | |
name: DataTypes.STRING, |
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
[ | |
{ | |
"logo": "https://www.car-logos.org/wp-content/uploads/2011/09/abarth1.png", | |
"name": "Abarth" | |
}, | |
{ | |
"logo": "https://www.car-logos.org/wp-content/uploads/2011/09/ac-cars.png", | |
"name": "AC" | |
}, | |
{ |
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
{ | |
"data": { | |
"GetTodosAsAssignee": [ | |
{ | |
"id": 7, | |
"report_id": 64, | |
"text": "do the dishes", | |
"status": "awaiting", | |
"assignee": [ |
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
const OAUTH2_OPTIONS = { | |
facebookLogin() { | |
// do the oath2 procedure for FB | |
}, | |
googleLogin() { | |
// do the oath2 procedure for google | |
}, | |
instagramLogin() { | |
// do the oath2 procedure for instagram | |
} |
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
// respond variable was given before | |
function displayContent(attrName, lang) { | |
const valid_attrs = ["title", "abstract"] | |
const valid_langs = ["en", "nl", "fr"] | |
// validate attrName and lang before accessing property | |
if (valid_attrs.includes(attrName) && valid_langs.includes(lang)) return respond.data[attrName][lang] | |
return 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
{ | |
"status": 200, | |
"data":{ | |
"title": { | |
"en": "How many hot-dogs can you eat?", | |
"nl": "Hoevel hot-dogs kunt gij eten?", | |
"fr": "Combien de hot-dogs peux-tu manger?", | |
}, | |
"abstract": { | |
"en": "Deep dive into the dark world of hot-dog eaters contest...", |
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
// shallow copy | |
function cloneWithProto (source, target = {}) { | |
// if you just want to copy the source the target is optional | |
let clone = {...source, ...target} | |
// make shallow copy out of source, and overwrite with target | |
Object.setPrototypeOf(clone, Object.getPrototypeOf(source)) | |
// set the proto of result to the proto of source object | |
return clone |
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
import { SET_BOOKNAME, ADD_BOOKMARK, DELETE_BOOKMARK } from '../actions/types'; | |
export default function bookmarksReducer(state = {book_name: "", list: []}, action) { | |
switch (action.type) { | |
case SET_BOOKNAME: | |
return {...state, book_name: action.payload} | |
// copy the current state | |
// and change the value of book_name property | |
// with payload property given by the action | |
case ADD_BOOKMARK: |