Skip to content

Instantly share code, notes, and snippets.

View hcastillaq's full-sized avatar

Hernan Castilla hcastillaq

View GitHub Profile
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { EntityDataModule } from '@ngrx/data';
import { entityConfig } from './entity-metadata';
import { EffectsModule } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store';
import { HttpClientModule } from '@angular/common/http';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
@hcastillaq
hcastillaq / base.service.ts
Created April 29, 2020 04:28
Angular Service - BaserService for HttpRequests, declare all methods and implement this class in other services
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
@Injectable({
providedIn: 'root',
})
export class BaseService {
constructor(private http$: HttpClient) {}
get(url, params: HttpParams = new HttpParams()) {
@hcastillaq
hcastillaq / ci_gitlab
Created January 24, 2020 07:56
ci gitlab basico
build:
image: node:latest
stage: build
script:
- rm package-lock.json
- npm install --progress=false
- npm run production --no-progress
artifacts:
expire_in: 10 mins
paths:
@hcastillaq
hcastillaq / ci_gitlab
Created January 24, 2020 05:59
ssh gitlab ci
deploy:
image: alpine
stage: deploy
script:
- apk add --no-cache rsync openssh
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" >> ~/.ssh/id_dsa
- chmod 600 ~/.ssh/id_dsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- touch hola.txt
@hcastillaq
hcastillaq / keybindings.json
Created January 16, 2020 05:22
keybindings for vscode
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "alt+left",
"command": "workbench.action.navigateBack"
},
{
"key": "ctrl+alt+-",
"command": "-workbench.action.navigateBack"
},
@hcastillaq
hcastillaq / .zshrc
Last active January 16, 2020 07:17
zsh
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/hcastillaq/.oh-my-zsh"
ZSH_THEME="robbyrussell"
plugins=(git zsh-syntax-highlighting zsh-autosuggestions node npm)
@hcastillaq
hcastillaq / tmux.config
Last active January 15, 2020 21:55
Tmux
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix 'M'
bind-key -n 'M' send-prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
{"short_name":"hcastillaq","name":"Blog personal de Hernan Castilla","start_url":"/","background_color":"#212121","display":"standalone","theme_color":"#1d1f21","icons":[{"src":"/imagenes/x48.png","type":"image/png","sizes":"48x48"},{"src":"/imagenes/x96.png","type":"image/png","sizes":"96x96"},{"src":"/imagenes/x192.png","type":"image/png","sizes":"192x192"},{"src":"/imagenes/x512.png","type":"image/png","sizes":"512x512"}]}
var CACHE_NAME = "hcq-cache";
var urlToCache = [
'/',
'/index.html',
'/css/fonts/MesloLGM-Regular.ttf'
];
self.addEventListener('install', function(event)
{
@hcastillaq
hcastillaq / Observable.js
Created September 1, 2018 22:02
Simple Observable with javascript
let _instanceObserver = null;
class Observable{
constructor()
{
if( _instanceObserver == null )
{
_instanceObserver = this;
this.observers = {};