Skip to content

Instantly share code, notes, and snippets.

View ALEXOTANO's full-sized avatar
🎯
Focusing

Alex Otano ALEXOTANO

🎯
Focusing
View GitHub Profile
@ALEXOTANO
ALEXOTANO / autocomplete-chrome.md
Last active August 14, 2019 20:21
Como eliminar - deshabilitar autocomplete de Chrome

Eliminar / Deshabilitar el autocomplete de Chrome,

Para evitar que chrome sugiera el autocomplete de nuestros campos

Pasos
  1. Agregar autocomplete="string" donde string es cualquier cosa que no sea off en la etiqueta form quedando por ejemplo:
<form autocomplete="bla_bla_bla">
@ALEXOTANO
ALEXOTANO / formatear-fechas-angular.md
Last active August 14, 2019 20:29
Formatear Fechas Angular
Use DatePipe pipe
date_expression | date[:format]

in your case

{{ date_expression | date:'dd-MM-yy' }}

How to use the pipe inside the component :

@ALEXOTANO
ALEXOTANO / Material-Angular-Password- visible_invisible.md
Last active August 14, 2019 20:24
a Input using Angular Material + Fontawsome with the visible not visible functionality clicking on the eye icon at the right
View/Hide Password Input

Remember to change the passH variable to a diffrent one in each input you place in the dom within the same scope. Using the name/id + and H ( as in Hide xD ) is usally a good idea to avoid repeating.

<mat-form-field>
    <input [type]="!passH ? 'password' : 'text'" matInput placeholder="A new Password" [(ngModel)]="pass" name="pass">
    <div matSuffix (click)="passH = !passH"><i class="fas fa-{{!passH ? 'eye-slash' : 'eye'}} "></i></div>
@ALEXOTANO
ALEXOTANO / Random-string.md
Last active August 14, 2019 20:13 — forked from 6174/Random-string
Generacion de un string random en una sola linea!
@ALEXOTANO
ALEXOTANO / HTML-to-text.md
Last active August 14, 2019 20:25
Convert HTML to plain text, strip text from HTML string
Convert HTML to plain text, strip text from HTML string

Some of the regex are for specific use, add as many as you want for exceptcions, but any generic HTML string will be parsed perfectly.

str=str.replace(/{\s*\/*.+?}/ig, "");
str=str.replace(/<\s*br\/*>/gi, "\n");
str=str.replace(/<\s*a.*href="(.*?)".*>(.*?)<\/a>/gi, " $2 (Link->$1) ");
str=str.replace(/<\s*\/*.+?>/ig, "\n");
str=str.replace(/ {2,}/gi, " ");
str=str.replace(/\n+\s*/gi, "\n\n");
@ALEXOTANO
ALEXOTANO / Angular-Observable-Next-Form-Outside.md
Last active October 10, 2019 02:25
Executing next data Observable from outide the Observable, Angular TypeScript

Declare it

private obs = new Subject<string>();
public _obs = this.obs.asObservable();

it is public so you can subscribe to it from any other component

Use it any where within the class

@ALEXOTANO
ALEXOTANO / deep-clone-javascript.md
Created August 14, 2019 19:58
The best way to deep clone an object / array of objects in javasciprt

When an object has more objects inside, Object.Assign doesn't do the trick.

The easist way to do it:

var originalObject = { 
  p: new Date(), 
  a: 123, 
  otherObj: { 
 m: 'more data', 
@ALEXOTANO
ALEXOTANO / bashrc-settings.md
Last active August 26, 2019 16:26
my bashrc setting with comments and tips

This is how I configure my bashrc file

# ALEX: WE NEED TO HAVE THE DIRCOLORS FILE - NOT SURE IF THIS COMES AS DEFAULT ON UBUNTU - GOOGLE DIRCOLORS... 
# I DID A BACKUP OF MY DIRCOLORS IN GIST
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
@ALEXOTANO
ALEXOTANO / mydircolors.md
Created August 26, 2019 16:15
my .dircolors file
# Exact Solarized Dark color theme for the color GNU ls utility.
# Designed for dircolors (GNU coreutils) 5.97
#
# This simple theme was simultaneously designed for these terminal color schemes:
# - Solarized dark  (best)
# - Solarized light
# - default dark
# - default light
# with a slight optimization for Solarized Dark.
@ALEXOTANO
ALEXOTANO / zsh-alex-theme.md
Created August 26, 2019 19:48
my Oh My Zsh Theme
#BASE IN AVIT.... BY LAEX

# PROMPT='
# $(_user_host)${_current_dir} $(git_prompt_info)
# %{$fg[$CARETCOLOR]%}▶%{$resetcolor%} '
PROMPT='
$(_user_host)${_current_dir} $(git_prompt_info)
%{$fg[$CARETCOLOR]%} $CARET%{$resetcolor%} '