This file contains 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
.videoWrapper { | |
position: relative; | |
padding-bottom: 56.25%; /* 16:9 */ | |
padding-top: 25px; | |
height: 0; | |
} | |
.videoWrapper iframe { | |
position: absolute; | |
top: 0; | |
left: 0; |
This file contains 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
function Fencepost(x, y, postNum) { //Constructor | |
this.x = x; | |
this.y = y; | |
this.postNum = postNum; | |
this.connectionsTo = []; | |
this.sendRopeTo = function(connectedPost) { | |
this.connectionsTo.push(connectedPost); | |
}; | |
} |
This file contains 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
$('element').on('wheel', function(e){ | |
var eo = e.originalEvent; | |
if(Math.abs(eo.wheelDeltaY) < 10 && Math.abs(eo.wheelDeltaX) > 2){ | |
e.preventDefault(); | |
if(eo.wheelDeltaX < -100){ | |
// swipe left | |
} | |
if(eo.wheelDeltaX > 100){ | |
// swipe right |
This file contains 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
export class Databus { | |
// Creating the state data | |
private data: Subject<state> = new Subject(); | |
// Creating the databus | |
data$ = data.asObservable(); | |
// | |
public changeData() { | |
// Edit the data | |
This file contains 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
// New instance of the service with new instance of the component | |
@Component({ | |
selector: 'app-component', | |
templateUrl: './app-component.component.html', | |
providers: [ MyService ] | |
}) | |
export class Component { | |
constructor(private serive: MyService) {} | |
} |
This file contains 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
/************* TYPES ***********/ | |
1. Add typing to the following code: | |
let bankAccount = { | |
money: 2000, | |
deposit(value) { | |
this.money += value; | |
} | |
}; |
This file contains 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
<div class="card"> | |
<div class="card-header">Reactive form</div> | |
<div class="card-body"> | |
<form [formGroup]="form" (ngSubmit)="onSubmit()"> | |
<div class="form-group"> | |
<label>Name *</label> | |
<input placeholder="Enter your name" type="text" formControlName="name" class="form-control" [ngClass]="{ 'is-invalid': form.get('name').errors && form.get('name').touched }" | |
/> | |
<div *ngIf="form.get('name').errors && form.get('name').touched" class="invalid-feedback"> | |
<div *ngIf="form.get('name').errors['required']">This field is required</div> |
This file contains 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, ViewContainerRef, ComponentFactoryResolver, ComponentRef, ComponentFactory, Input, OnInit } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
// Injectable Component | |
@Component({ | |
selector: 'my-list', | |
template: '<li>{{data}}</li>' | |
}) | |
export class MyItemComponent { | |
@Input() data; |
This file contains 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 { perfume } from 'src/app/perfume'; | |
import { PerfumeAfterViewInit } from 'perfume.js/angular'; | |
@Component({ | |
selector: 'ngfor-perfomance', | |
template: ` | |
<ul> | |
<li *ngFor="let d of data; let l = last; let f = first;"> | |
<span *ngIf="f">{{ngForCallback(true)}}</span> | |
{{d.name}} |
This file contains 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 Perfume from 'perfume.js'; | |
export const perfume = (function () { | |
let perfume = null; | |
function createInstance() { | |
var object = new Perfume({ | |
logPrefix: "🍻 xthecapx Hacks", | |
timeToInteractive: true | |
}); |
OlderNewer