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
// a few seconds ago | |
moment.fn.fromNowOrNow = function (a) { | |
if (Math.abs(moment().diff(this)) < 25000) { // 25 seconds before or after now | |
return 'just now'; | |
} | |
return this.fromNow(a); | |
} | |
// check expiry | |
const isExpired = moment().isAfter(activity.endDate); |
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
'use strict'; | |
const assert = require('assert'); | |
/** | |
* The redis client is https://github.com/luin/ioredis | |
*/ | |
/* | |
const redisClient = new Redis({ |
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
module.exports = { | |
webpack: function (cfg) { | |
const originalEntry = cfg.entry | |
cfg.entry = async () => { | |
const entries = await originalEntry() | |
if ( | |
entries['main.js'] && | |
!entries['main.js'].includes('./client/polyfills.js') | |
) { |
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
/********** | |
server.ts | |
--------------- | |
Simple file written in ES6 to serve a ExpressJS/NextJS Server. | |
Uses SSL, Compression, redirection and service worker routing. See server config file at : | |
https://github.com/glemiere/nextjs-starter/tree/master/config | |
--------------- | |
Requires Let's Encrypt SSL Certificate : | |
https://letsencrypt.org/ | |
**********/ |
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
import * as React from 'react' | |
import * as Redux from 'redux' | |
import { MyReduxState } from './my-root-reducer.ts' | |
export interface OwnProps { | |
propFromParent: number | |
} | |
interface StateProps { |
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
import { throwError as observableThrowError, from as observableFrom, Observable, TimeoutError, of } from 'rxjs'; | |
import { mergeMap, catchError, timeout, retryWhen, concatMap } from 'rxjs/operators'; | |
import { Injectable } from '@angular/core'; | |
import { HttpClient, HttpParams } from '@angular/common/http'; | |
import { EntityService } from '../entity/entity.service'; | |
import { UserService } from '../../promoter/legacy/_common/services/user-service/user.service'; | |
import rmaProperties from '../../../rmaProperties'; |
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
// match regex yes | |
rl.question('Are you sure you want to download reference pictures? (y(es))', async (answer) => { | |
if (answer.match(/^y(es)?$/i)) { | |
await downloadNewRefPics(newRefPicsList); | |
} | |
rl.close(); | |
}); |
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
import { ContactBarController } from './contactBar.controller'; | |
angular.module('RateMyAgent.Common').component('rmaContactBar', { | |
templateUrl: '/templates/_common/contact-bar/contactBar.html', | |
bindings: { | |
agent: '<', | |
buttonLocation: '<' | |
}, | |
controllerAs: '$ctrl', | |
controller: ContactBarController |
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 only a code snippet and should only provide a guide of testing scenarios. | |
describe('rmaLeasingLocationAwards', () => { | |
let $q; | |
let $componentController; | |
let $rootScope; | |
let controller; | |
beforeEach(() => { | |
angular.mock.module('RateMyAgent.Profiles.Locations.Leasing'); |
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
import { | |
ReactiveFormsModule, | |
NG_VALIDATORS, | |
FormsModule, | |
FormGroup, | |
FormControl, | |
ValidatorFn, | |
Validator | |
} from '@angular/forms'; | |
import { Directive } from '@angular/core'; |