This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Javascript TODO list</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<div class="header"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Reputation Ranking</title> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.css" /> | |
<link rel="stylesheet" href="style.css"> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pipe, PipeTransform } from '@angular/core'; | |
import { DomSanitizer, SafeHtml, SafeStyle, SafeScript, SafeUrl, SafeResourceUrl } from '@angular/platform-browser'; | |
@Pipe({ | |
name: 'safe' | |
}) | |
export class SafePipe implements PipeTransform { | |
constructor(protected sanitizer: DomSanitizer) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { existsSync, mkdirSync } from 'fs'; | |
import { dirname } from 'path'; | |
function makeDirectory(target: string) { | |
// check if parent directory exists | |
const parentDir = dirname(target); | |
if (!existsSync(parentDir)) { | |
makeDirectory(parentDir); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//using your function (passing in date) | |
function formatAMPM(date) { | |
let days = date.getUTCDate(); | |
let month = date.getUTCMonth() + 1; | |
const year = date.getUTCFullYear(); | |
let hours = date.getHours(); | |
let minutes = date.getMinutes(); | |
const ampm = hours >= 12 ? 'pm' : 'am'; | |
// converts hours to 12 hour instead of 24 hour | |
hours = hours % 12; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Directive, Input, ElementRef, Renderer} from '@angular/core'; | |
import {WindowService} from "../../window/window.service"; | |
@Directive({ | |
selector: '[affix]' | |
}) | |
export class AffixDirective { | |
@Input() affix: any; | |
parent: HTMLElement; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Directive, ElementRef, HostListener, Renderer2} from '@angular/core'; | |
@Directive({ | |
selector: '[ripple]' | |
}) | |
export class RippleDirective { | |
hostEl; | |
constructor(private renderer: Renderer2, el: ElementRef) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This example demonstrates how to get a single post by id | |
*/ | |
import { Component } from '@angular/core'; | |
import { WpModel, WpPost } from "ng2-wp-api"; | |
@Component({ | |
selector: 'test-model', | |
template: ` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* In this example, we display a collection of posts, pagination and a button to load the next page. | |
* we also set the QueryArgs for the request to get embedded posts and filter the results to 6 posts per page | |
* | |
* get pagination properties from `wpCollection.service` | |
*/ | |
import { Component, OnInit } from '@angular/core'; | |
import {WpEndpoint, WpService, CollectionResponse} from 'ng2-wp-api'; | |
@Component({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component, ViewChild, AfterViewInit} from '@angular/core'; | |
import {WpEndpoint, CollectionDirective, CollectionResponse} from '../../core/wordpress'; | |
@Component({ | |
selector: 'feed-page', | |
templateUrl: ` | |
<div class="feed" #feed [wpCollection]="postsEndpoint" [wpArgs]="postsArgs"> | |
<ul> | |
<li *ngFor="let post of posts">{{post.title()}}</li> |