Skip to content

Instantly share code, notes, and snippets.

Bazel CLI

Bazel is a powerful build tool created at Google.

It is rock solid and scales really well. (Bazel is an open source version of the tool used at Google. Facebook, Uber, Twitter all use similar tools.)

Bazel and Nx Workspace

@Atibaashraf
Atibaashraf / Using Redux Thunk middleware, declare some action creators
Last active March 30, 2021 10:00
What's the redux idiom for waiting for multiple async calls?
import 'babel-core/polyfill'; // so I can use Promises
import fetch from 'isomorphic-fetch'; // so I can use fetch()
function doSomething() {
return dispatch =>
fetch(
'/api/something'
).then(
response => response.json()
).then(
@Atibaashraf
Atibaashraf / Utility Example: Logging with do
Created October 11, 2017 11:21
signature: do(nextOrObserver: function, error: function, complete: function): Observable - Transparently perform actions or side-effects, such as logging.
const source = Rx.Observable.of(1,2,3,4,5);
//transparently log values from source with 'do'
const example = source
.do(val => console.log(`BEFORE MAP: ${val}`))
.map(val => val + 10)
.do(val => console.log(`AFTER MAP: ${val}`));
//'do' does not transform values
//output: 11...12...13...14...15
const subscribe = example.subscribe(val => console.log(val));
@Atibaashraf
Atibaashraf / app-component.ts
Last active October 11, 2017 11:10
Adding tic tac toe game and basic tests
import {Component} from '@angular/core';
@Component({
selector: 'ttt-app',
template: `
<ttt-game></ttt-game>
`,
})
export class AppComponent {
}