Skip to content

Instantly share code, notes, and snippets.

Stepan Suvorov stevermeister

Block or report user

Report or block stevermeister

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@stevermeister
stevermeister / bazel-start.sh
Last active Oct 5, 2018
Run to setup bazel files for fresh ng-cli project
View bazel-start.sh
yarn global add @bazel/ibazel
curl https://raw.githubusercontent.com/alexeagle/canonical-angularcli-app/master/.bazelrc > .bazelrc
curl https://raw.githubusercontent.com/alexeagle/canonical-angularcli-app/master/WORKSPACE > WORKSPACE
curl https://raw.githubusercontent.com/alexeagle/canonical-angularcli-app/master/BUILD.bazel > BUILD.bazel
curl https://raw.githubusercontent.com/alexeagle/canonical-angularcli-app/master/src/BUILD.bazel > ./src/BUILD.bazel
curl https://raw.githubusercontent.com/alexeagle/canonical-angularcli-app/master/e2e/protractor.on-prepare.js > ./e2e/protractor.on-prepare.js
curl https://raw.githubusercontent.com/alexeagle/canonical-angularcli-app/master/e2e/BUILD.bazel > ./e2e/BUILD.bazel
curl https://raw.githubusercontent.com/alexeagle/canonical-angularcli-app/236406851409a88e85b3cdc9e6eaa250061fd7cc/src/main.ts > ./src/main.ts
curl https://raw.githubusercontent.com/alexeagle/canonical-angularcli-app/06151761ded53d22a2d03b9e6d67c31f045559af/src/index.html > ./src/index.html
View takeUntil.ts
export class TestComponent {
constructor(private store: Store) { }
private componetDestroyed: Subject = new Subject();
todos: Subscription;
posts: Subscription;
ngOnInit() {
this.todosSubscription = this.store.select('todos').takeUntil(this.componetDestroyed).subscribe(console.log);
@stevermeister
stevermeister / ng-watch-visualisation
Created Mar 14, 2015
AngularJS watchers visualization
View ng-watch-visualisation
(function visualizeAngularWatchers() {
var i, data, scope,
count = 0,
all = document.all,
len = all.length,
test = {},
overlayMain = angular.element('<div/>');
overlayMain.css({'z-index': 9999});
angular.element(document.body).append(overlayMain);
View subscribe.redux-mini.js
function createStore(reducer, initialState) {
var currentReducer = reducer;
var currentState = initialState;
var listener = () => {};
return {
getState() {
return currentState;
},
dispatch(action) {
View example.redux-mini.js
function counter(state = 0, action) {
switch (action.type) {
case 'INCREMENT':
return state + 1
case 'DECREMENT':
return state - 1
default:
return state
}
}
View angular-switchery-reactive.html
<angular-switchery #f="ngForm" [formControl]="switcheryControl"></angular-switchery>
switcheryControl.value : {{f.value}}
View angular-switchery.html
<angular-switchery [(ngModel)]="swticherModel"></angular-switchery>
<angular-switchery [(ngModel)]="swticherModel"></angular-switchery>
Switcher: {{swticherModel? 'ON' : 'OFF'}}
View bootstrapModule.ViewEncapsulation.ts
platformBrowserDynamic().bootstrapModule(AppModule, [
{
defaultEncapsulation: ViewEncapsulation.None
}
]);
View angular-viewChild.ts
@ViewChild('name') nameInput: ElementRef;
ngAfterViewInit() {
console.log(this.nameInput.value)
}
You can’t perform that action at this time.