Skip to content

Instantly share code, notes, and snippets.

import { Component } from '@angular/core';
import { ActivatedRouteSnapshot, NavigationEnd, Params, PRIMARY_OUTLET, Router } from '@angular/router';
import { filter } from 'rxjs/operators';
interface BreadcrumbItem {
label: string;
params?: Params;
url: string;
}
private initSuggestionsMoreBtn(): void {
Observable.fromEvent(this.moreSuggestionsBtn.nativeElement, 'click')
.mapTo(this.stepSuggestions)
.scan((acc, cur) => {
return acc < this.suggestions.length ? acc + cur : this.initialLimitSuggestions;
}, this.initialLimitSuggestions)
.takeUntil(this.onDestroy$)
.subscribe(
res => {
this.limitSuggestions = res;
console.log('geoloc start');
var geolocStart = +new Date();
navigator.geolocation.getCurrentPosition(
function (position) {
console.log('geoloc end');
var min = 5000,
start = geolocStart,
end = position.timestamp,
elapsed = end - start;
@jrmlstf
jrmlstf / gist:7115874
Created October 23, 2013 10:03
Sublime prefs
[
{ "keys": ["super+shift+r"], "command": "reindent", "args": {"single_line": false} },
{ "keys": ["super+shift+e"], "command": "abacus" },
{ "keys": ["super+alt+k"], "command": "fold_by_level", "args": {"level": 1} },
{ "keys": ["super+alt+,"], "command": "fold_by_level", "args": {"level": 2} },
{ "keys": ["super+alt+i"], "command": "fold" },
{ "keys": ["super+alt+j"], "command": "unfold" }
]
(function () {
var TestView = Backbone.View.extend({
el: '#container',
initialize: function () {
console.log('Inside Init');
@jrmlstf
jrmlstf / pginit.js
Last active December 17, 2015 18:19
Init app ondeviceready or load if it's a phonegap app or not. From https://github.com/triceam/PhoneGap-Legends/blob/master/js/index.js
//detect if web or phonegap ( via http://stackoverflow.com/questions/8068052/phonegap-detect-if-running-on-desktop-browser)
function isPhoneGap() {
return ((cordova || PhoneGap || phonegap)
&& /^file:\/{3}[^\/]/i.test(window.location.href)
&& /ios|iphone|ipod|ipad|android/i.test(navigator.userAgent)) ||
window.tinyHippos; //this is to cover phonegap emulator
}
function init(event) {
console.log("init app");
@jrmlstf
jrmlstf / 0_reuse_code.js
Created March 4, 2014 17:34
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