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 tags = { | |
Advertising: "Advertising", | |
Architecture: "Architecture", | |
Aviation: "Aviation", | |
Banking: "Banking", | |
Business: "Business", | |
Construction: "Construction", | |
Design: "Design", | |
Economics: "Economics", | |
Engineering: "Engineering", |
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
1/04/2020 | |
8:30 - study nestJS | |
9:30 - team call | |
-> remember wrap to wrap up project task | |
10 - break | |
10:15 - deploy with cloud66 using docker compose, find out how to connect frontend with backend | |
-> deployment went fine, had to define custom file! |
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 { RESPONSE, REQUEST } from '@nguniversal/express-engine/tokens'; | |
import { renderModuleFactory } from '@angular/platform-server'; | |
// These are important and needed before anything else | |
import 'zone.js/dist/zone-node'; | |
import 'reflect-metadata'; | |
import { enableProdMode, ValueProvider, FactoryProvider } from '@angular/core'; | |
// Import module map for lazy loading | |
import {provideModuleMap} from '@nguniversal/module-map-ngfactory-loader'; | |
import { registerLocaleData } from '@angular/common'; |
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
getPathAndFileName(fileUri: string): { path: string; name: string } => { | |
const splittedUri = fileUri.split('/').filter(x => x); | |
const path = `${splittedUri.slice(0, -1).join('/')}/`; | |
const name = splittedUri.slice(-1).join(); | |
return { path, name }; | |
} |
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
Component code | |
.... | |
ngAfterViewInit() { | |
const config = { attributes: false, childList: true, subtree: true }; | |
this.messageTreeObserver = new MutationObserver((mutationList, observer) => { | |
for (const mutation of mutationList) { | |
if (mutation.type === 'childList') { | |
// Do action here! | |
} | |
} |
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
# Buffer is a default Nodejs global object | |
const initialString = 'michelepatrassi'; | |
const token = Buffer.from(initialString).toString('base64'); | |
# want to get it back? | |
const welcomeBack = Buffer.from(token, 'base64').toString('ascii'); | |
if (initialString === welcomeBack) { | |
console.log('all good!'); |
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 axios = require('axios') | |
const qs = require('querystring') | |
... | |
const requestBody = { | |
name: 'Akexorcist', | |
age: '28', | |
position: 'Android Developer', | |
description: 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/', |
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
// add this code to your server.ts | |
// implementation credits: https://gist.github.com/paulirish/1579671 | |
global['requestAnimationFrame'] = function(callback, element) { | |
let lastTime = 0; | |
const currTime = new Date().getTime(); | |
const timeToCall = Math.max(0, 16 - (currTime - lastTime)); | |
const id = setTimeout(function() { callback(currTime + timeToCall); }, | |
timeToCall); | |
lastTime = currTime + timeToCall; |
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 * as functions from 'firebase-functions'; | |
import * as admin from 'firebase-admin'; | |
import MailchimpApi = require('mailchimp-api-v3'); | |
import md5 = require('crypto-js/md5'); | |
const CRON_SCHEDULE = '* * * * *'; | |
export const cronMailchimp = functions.region('europe-west1').pubsub | |
.schedule(CRON_SCHEDULE).onRun(async context => { | |
const { audience, apikey } = functions.config().mailchimp; |
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 * as functions from 'firebase-functions'; | |
import * as admin from 'firebase-admin'; | |
import MailchimpApi = require('mailchimp-api-v3'); | |
import md5 = require('crypto-js/md5'); | |
const CRON_SCHEDULE = '* * * * *'; | |
const API_KEY = 'YOUR_API_KEY'; | |
const AUDIENCE_ID = 'YOUR_AUDIENCE_ID'; | |
export const cronMailchimp = functions.region('europe-west1').pubsub |
NewerOlder