Skip to content

Instantly share code, notes, and snippets.

View hollygood's full-sized avatar

Kathy H. hollygood

View GitHub Profile
@hollygood
hollygood / github-to-bitbucket.md
Last active June 11, 2021 17:55 — forked from sangeeths/github-to-bitbucket
Forking a Github repo to Bitbucket
  • Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone git@bitbucket.org:abc/myforkedrepo.git
cd myforkedrepo
  • Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync git@github.com:def/originalrepo.git
@hollygood
hollygood / some-tricks.md
Last active May 17, 2021 01:54
JS Arrays || Objects Tricks

Some Common JS Tricks

Toggle Sorting function

// Normal way
if ( this.orderBy ) {
  results = this.order === 'asc' ? 
  results[0].sort( (a, b) => ( 
    a[ this.orderBy ] > b[ this.orderBy ] ) ? 1 : -1 ):
  results[0].sort( (a, b) => ( 
@hollygood
hollygood / react-best-practices.md
Last active May 17, 2021 01:45
Some React Best Practices

React Best Practices

Map Function for Dynamic Rendering of Arrays

render () {
  let cartoons = [ "Pika", "Squi", "Bulb", "Char" ];
  return (
  <ul>
    {cartoons.map(name => <li key={name}>{name}</li>)}
  </ul>
  );
@hollygood
hollygood / pass-async-data-to-child.ts
Created January 8, 2019 14:20
Angular 6 Pass Async Data to Child Components
// blogger.component.ts
...
template: `
<h1>Posts by: {{ blogger }}</h1>
<div>
<posts [data]="posts"></posts>
</div>
`
...
@hollygood
hollygood / angular-upgrade-notes.txt
Created July 31, 2020 15:02
Angular Upgrade Notes
1. Follow the instructions here: https://update.angular.io/
Select the current Angular version and expected verson to upgrade
2. Write Document
* Make suggestions from https://update.angular.io/ as a task list, mark complete when done
3. Dependencies Table
Make a table for each dependency from package.json, which includes package name, npm script (npm i -D xxx),
version changes, code affected, package changelog link, and progress. eg.
@hollygood
hollygood / kotlin-gradle-build.ts
Created October 4, 2019 15:06
Kotlin For Gradle Build
Define variable in root project and access it in subprojects by using extra
1) val foo: String by extra["hello"]
2) extra["foo"] = "hello"
3)
buildScript {
extra.apply {
set("foo", "hello")
}
}
@hollygood
hollygood / mutiple-http-streams-with-rxjs.ts
Created December 13, 2018 16:49
Mutiple Http streams with RxJS
/**
* @function forkJoin multiple requests with ngrx selects
* we can't use forkJoin for ngrx selects because this method requires the Observables being 'complete'
* in case of ngrx store, all of their observables are usually based on a BehaviorSubject, and will never complete
* the only way we can do is using like this: forkJoin(user$.take(1), customCarList$.take(1)
*/
const result$ = forkJoin([
this.store.select(selectOne).pipe(take(1)),
this.store.select(selectTwo).pipe(take(1)),
this.store.select(selectThree).pipe(take(1))
@hollygood
hollygood / angular6-unsubscribe.md
Last active May 17, 2019 14:31
Different ways to unsubscribe Angular 6 Observables

Use 'unsubscribe':

export class ExampleComponent implements OnInit, OnDestroy {
  exampleSubOne: Subscription;
  exampleSubTwo: Subscription;

  constructor(private exampleService: ExampleService) {}

  ngOnInit() {
@hollygood
hollygood / angular-parent-child-component.md
Created April 25, 2019 14:34
Creating a Reactive Form in Parent Component or Child Component

Example 1

// parent.component.ts
form: FormGroup;

ngOnInit() {
   this.form = new FormGroup({}); // create empty FormGroup in order to addControls in nested components
}

// parent.component.html
@hollygood
hollygood / expressionChangedError.md
Last active April 17, 2019 19:34
ExpressionChangedAfterItHasBeenCheckedError

mat-form-field causes Error: ExpressionChangedAfterItHasBeenCheckedError

link: angular/components#12714

I also got the same error by using mat-form-field in ng-bootstrap modal:

"ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'mat-form-field-should-float: false'. Current value: 'mat-form-field-should-float: true'."

ChangeDetectionStrategy.OnPush doesn't work for me.