Skip to content

Instantly share code, notes, and snippets.

View JakubPawlak's full-sized avatar

Jakub Pawlak JakubPawlak

View GitHub Profile
[core]
autocrlf = input
editor = code --wait
[alias]
a = add --all
ap = add --patch
ai = add -i
b = branch
bdd = branch -D
co = checkout
@JakubPawlak
JakubPawlak / home.component.ts
Created January 17, 2019 12:49
Restaurant finder part 2 - navigation extras
const navigationExtras = {
queryParams: {
"geolocation": JSON.stringify(this.currentGeoLocation),
},
transition: {
name: "slide",
duration: 250,
curve: "easeInOut"
}
};
@JakubPawlak
JakubPawlak / home.component.ts
Created January 17, 2019 12:13
Restaurant finder part 2 - on current location tap
onCurrentLocationTap() {
const navigationExtras = {
queryParams: {
"geolocation": JSON.stringify(this.currentGeoLocation),
}
};
this._routerExtensions.navigate(['/categories'], navigationExtras);
}
@JakubPawlak
JakubPawlak / home.component.xml
Created January 17, 2019 11:54
Restaurant finder part 2 - location button
<Button *ngIf="currentGeoLocation" row="3" text="Current location" class="btn btn-primary h4" (tap)="onCurrentLocationTap()"></Button>
@JakubPawlak
JakubPawlak / categories.component.ts
Created January 17, 2019 11:30
Restaurant finder part 2 - categories component route data
export class CategoriesComponent {
currentGeoLocation: any;
constructor(private _activatedRoute: ActivatedRoute) {
try {
this.currentGeoLocation = JSON.parse(this._activatedRoute.snapshot.queryParams['geolocation']);
} catch (e) {
console.error(e);
}
}
@JakubPawlak
JakubPawlak / categories.component.xml
Created January 17, 2019 11:28
Restaurant finder part 2 - basic component layout
<StackLayout *ngIf="currentGeoLocation">
<Label text="Latitude: {{ currentGeoLocation.latitude }}"></Label>
<Label text="Longitude: {{ currentGeoLocation.longitude }}"></Label>
<Label text="Altitude: {{ currentGeoLocation.altitude }}"></Label>
<Label text="Direction: {{ currentGeoLocation.direction }}"></Label>
</StackLayout>
@JakubPawlak
JakubPawlak / app-routing.module.ts
Created January 17, 2019 11:28
Restaurant finder part 2 - app routing
const routes: Routes = [
{ path: "", redirectTo: "/categories", pathMatch: "full" },
{ path: "home", loadChildren: "./home/home.module#HomeModule" },
{ path: "categories", loadChildren: "./categories/categories.module#CategoriesModule" }
];
@JakubPawlak
JakubPawlak / categories-routing.module.ts
Created January 17, 2019 11:27
Restaurant finder part 2 - categories routing module
import { NgModule } from "@angular/core";
import { Routes } from "@angular/router";
import { NativeScriptRouterModule } from "nativescript-angular/router";
import { CategoriesComponent } from "./categories.component";
const routes: Routes = [
{ path: "", component: CategoriesComponent }
];
@JakubPawlak
JakubPawlak / app.css
Created January 17, 2019 11:16
Restaurant finder part 2 - styling
.btn-primary {
border-radius: 10;
background-color: #FF4F3C;
color: white;
text-transform: none;
height: 54;
}
.btn-primary:highlighted {
color: white;
@JakubPawlak
JakubPawlak / home.component.ts
Created January 17, 2019 11:15
Restaurant finder part 2 - home ngOnInit
ngOnInit(): void {
this.enableLocationServices();
}