Skip to content

Instantly share code, notes, and snippets.

import './polyfills.ts';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';
import { AppModule } from './app/';
if (environment.production) {
enableProdMode();
}
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('d3'), require('d3-selection-multi')) :
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'd3', 'd3-selection-multi'], factory) :
(factory((global.KnobModule = {}),global.core,global.d3));
}(this, (function (exports,core,d3) { 'use strict';
var Ng2KnobDirective = /** @class */ (function () {
function Ng2KnobDirective(el) {
this.el = el;
this.valueChange = new core.EventEmitter();
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
if (someCondition) {
this.router.navigate(['not-allowed']);
return false;
}
return true;
}
@sliceofbytes
sliceofbytes / course-events.ts
Created April 20, 2018 15:12
Course events
import { Action } from '@ngrx/store';
import { Effect, Actions } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import * as course from '../actions/course';
import { CourseService, Course } from '../../shared';
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/startWith';
@sliceofbytes
sliceofbytes / course-events.ts
Created April 20, 2018 15:12
Course events
import { Action } from '@ngrx/store';
import { Effect, Actions } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import * as course from '../actions/course';
import { CourseService, Course } from '../../shared';
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/startWith';
@sliceofbytes
sliceofbytes / group-effects.ts
Created April 19, 2018 21:15
Is this stupid?
import { Action } from '@ngrx/store';
import { Effect, Actions } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import * as group from '../actions/group';
import { CourseService, Group, TreeItem } from '../../shared';
import 'rxjs/add/operator/switchMap';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/startWith';
@sliceofbytes
sliceofbytes / txt-to-google-keep-notes.py
Created February 14, 2018 22:16
Add Text Files as Google Keep Notes
#Import a directory of text files as google keep notes.
#Text Filename is used for the title of the note.
import gkeepapi, os
username = 'username@gmail.com'
password = 'your app password'
keep = gkeepapi.Keep()
success = keep.login(username,password)
@sliceofbytes
sliceofbytes / 0_reuse_code.js
Created April 4, 2016 04:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console