Skip to content

Instantly share code, notes, and snippets.

View AitorAlejandro's full-sized avatar

Aitor Alejandro Herrera AitorAlejandro

View GitHub Profile
import { AfterViewInit, Directive, ElementRef, Input, Renderer2 } from '@angular/core';
@Directive({
selector: '[appReadMore]'
})
export class ReadMoreDirective implements AfterViewInit {
@Input() limit : number = 50; //to get the custom text limit
@Input() toggle : boolean = false; //true: 'Read Less' button will be present
txtSpan! : HTMLSpanElement;

Install Angular ESLint

ng add @angular-eslint/schematics

Install Prettier and Prettier-ESLint dependencies

npm i prettier prettier-eslint eslint-config-prettier eslint-plugin-prettier -D

ESLint configuration

Filename: .eslintrc.json

@AitorAlejandro
AitorAlejandro / closure.js
Created June 3, 2022 12:14 — forked from henrik1/closure.js
Closure example
function counter() {
let count = 0;
function increment() {
return count += 1;
};
return increment;
}
@AitorAlejandro
AitorAlejandro / axiosApi.ts
Last active June 23, 2021 06:29 — forked from Mr-Malomz/api.ts
Axios API Request with TypeScript
import axios, { AxiosResponse } from 'axios';
import { PostType } from '../models/post.interface';
const instance = axios.create({
baseURL: 'http://jsonplaceholder.typicode.com/',
timeout: 15000,
});
const responseBody = (response: AxiosResponse) => response.data;
@AitorAlejandro
AitorAlejandro / keycodes.ts
Created December 4, 2019 11:54 — forked from kyranjamie/keycodes.ts
TypeScript Browser Key Codes Enum
enum keyCodes {
BACKSPACE: 8,
TAB: 9,
ENTER: 13,
SHIFT: 16,
CTRL: 17,
ALT: 18,
PAUSE: 19,
CAPS_LOCK: 20,
ESCAPE: 27,
@AitorAlejandro
AitorAlejandro / gist:a1b79c115b7d0f7ca9eec7b3170da01a
Created April 5, 2019 19:12 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
myElement.closest('article').querySelector('h1');
document.querySelector(document.location.hash).scrollIntoView();
const tableEl = document.querySelector('table');
const headerRow = tableEl.createTHead().insertRow();
headerRow.insertCell().textContent = 'Make';
headerRow.insertCell().textContent = 'Model';
headerRow.insertCell().textContent = 'Color';
const newRow = tableEl.insertRow();
newRow.insertCell().textContent = 'Yes';
newRow.insertCell().textContent = 'No';