Skip to content

Instantly share code, notes, and snippets.

View benjamincharity's full-sized avatar
🤖

Benjamin Charity benjamincharity

🤖
View GitHub Profile
@benjamincharity
benjamincharity / custom-date-adapter.ts
Created August 28, 2018 19:53
Custom date adaptor for material
import { NativeDateAdapter } from '@angular/material/core';
export const TS_DATE_FORMATS = {
parse: {
dateInput: {month: 'short', year: 'numeric', day: 'numeric'},
},
display: {
dateInput: 'input',
monthYearLabel: 'inputMonth',
removeByKey(array, params) {
array.some(function(item, index) {
if (array[index][params.key] === params.value) {
array.splice(index, 1);
return true;
}
return false;
});
return array;
}
import { Action, Store } from '@ngrx/store';
import { Subject } from 'rxjs/Subject';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
/**
* Standard mockstore that can be used in unittests to mock a @ngrx/store
*
* https://github.com/ngrx/store/issues/128#issuecomment-316654714
*/
lsof -n -i4TCP:4300
export const rollupGlobals = {
'tslib': 'tslib',
'moment': 'moment',
// lodash
'lodash': 'lodash',
'lodash-es': 'lodash-es',
'lodash-es/at': 'lodash-es/at',
'lodash-es/cloneDeep': 'lodash-es/cloneDeep',
'lodash-es/concat': 'lodash-es/concat',
@benjamincharity
benjamincharity / app-version.component.ts
Last active December 4, 2017 12:53
From: https://stackoverflow.com/a/41299263/722367 It's worth to mentioned that if someone encounter on error "Cannot find name require" after applying your solution then needs to add "node" type inside "types" property in tsconfig.app.ts file. << "types": ["node"] >>.
const { version: appVersion } = require('../../package.json')
// this loads package.json
// then you destructure that object and take out the 'version' property from it
// and finally with ': appVersion' you rename it to const appVersion
@Component({
selector: 'stack-overflow',
templateUrl: './stack-overflow.component.html'
})
export class StackOverflowComponent {
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"angular-whitespace": [
true,
"check-interpolation"
],
"arrow-parens": true,
{
"rules": {
"at-rule-name-space-after": "always",
"at-rule-semicolon-space-before": "never",
"at-rule-semicolon-newline-after": "always",
"at-rule-no-vendor-prefix": true,
"block-no-empty": true,
"block-closing-brace-newline-after": [
"always",
"ignoreAtRules": [
yarn remove karma-sauce-launcher
yarn add -D --exact karma-sauce-launcher
@benjamincharity
benjamincharity / 1.0.1-output.sh
Last active November 1, 2017 15:19
Docs working on `1.0.1`, not working on `1.0.2`
➜ my-app git:(fix-link-style-inheritence) ✗ yr docs
yarn run v1.2.1
$ yarn run docs:toc
DocToccing single file "./README.md" for github.com.
==================
"./README.md" will be updated