Skip to content

Instantly share code, notes, and snippets.

View arutnik's full-sized avatar

Andres Rutnik arutnik

View GitHub Profile
@arutnik
arutnik / index.html
Last active November 8, 2017 22:27
SFA Part 5: Deep link index
<app-root></app-root>
<script>
<!-- only added lines shown -->
gSfPageRoot = '';
if (typeof $SFPAGEROOT !== 'undefined') {
gSfPageRoot = $SFPAGEROOT;
}
function getSfPageRoot() {
return gSfPageRoot;
@arutnik
arutnik / visualforce_transform.py
Created November 5, 2017 20:17
SFA Part 5: Routing variable injection
#Only added lines shown
parser.add_argument("--pagename", help="")
pageName = args.pagename
inAppPageRoot = 'apex/' + pageName
html = html.replace('$SFPAGEROOT', "'" + inAppPageRoot + "'")
@arutnik
arutnik / gulpfile.js
Created November 5, 2017 20:19
SFA Part 6: Gulp serves
const gulp = require('gulp');
const run = require('gulp-run');
const watch = require('gulp-watch');
const batch = require('gulp-batch');
gulp.task('deploytosf', () => {
console.log('Running SF deploy script!')
return run('ant localDevDeploy -f salesforce/build.xml -lib salesforce/lib').exec('', function(e) {
if (!(e && e.status)) {
console.log('Page deployed!');
@arutnik
arutnik / package.json
Created November 5, 2017 20:20
SFA Part 6: Gulp dependencies
"gulp": "^3.9.1",
"gulp-batch": "^1.0.5",
"gulp-run": "^1.7.1",
"gulp-watch": "^4.3.11",
@arutnik
arutnik / bad-link.component.ts
Created July 8, 2018 19:31
SEO-SPA: Virtual Anchor
@arutnik
arutnik / pagination-service.ts
Created July 8, 2018 19:46
SEO-SPA: Pagination service
import { Injectable, Renderer2, Inject, ElementRef } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { DOCUMENT } from "@angular/platform-browser";
//This should be injected in the app component, and any component or service
//that is responsible for pagination
@Injectable()
export class PaginationService {
private totalPages: number;
private currentPageNumber: number;
@arutnik
arutnik / about-me.component.ts
Created July 8, 2018 19:51
SEO-SPA: Meta/Title
import { Component, OnInit } from '@angular/core';
import { Title, Meta } from '@angular/platform-browser';
//An example of a component setting title and description tags
@Component({
selector: 'app-about-me',
template: `
<p>This page is about me!</p>
`,
styleUrls: ['./about-me.component.scss']
@arutnik
arutnik / usage.ts
Created July 8, 2018 20:04
SEO-SPA: DI Service Usage
//In app.browser.module.ts providers:
{
provide: ElementFocusService,
useClass: ElementFocusBrowserService
},
//In app.server.module.ts providers:
{
@arutnik
arutnik / element-focus.service.ts
Created July 8, 2018 20:05
SEO-SPA: Abstract DI Service
import { ElementRef } from '@angular/core';
export abstract class ElementFocusService {
/**
* Transfers focus to an element
* @param element
*/
public abstract focusElement(element: ElementRef)
}
@arutnik
arutnik / element-focus.server.service.ts
Created July 8, 2018 20:06
SEO-SPA: Server DI Service
import { ElementFocusService } from './element-focus.service';
import { Injectable, ElementRef } from '@angular/core';
@Injectable()
export class ElementFocusServerService extends ElementFocusService {
constructor() {
super();
}