Skip to content

Instantly share code, notes, and snippets.

View workfel's full-sized avatar
🏠
Working from home

Johan pujol workfel

🏠
Working from home
View GitHub Profile
@workfel
workfel / badge.component.css
Last active October 31, 2018 19:58
Create angular library in your private npm registry on AzureDevOps  [ BADGE COMPONENT ] 
.badge{
width : fit-content;
padding: 4px;
border-radius: 30px;
}
.badge-success {
background: green;
}
@workfel
workfel / button.component.css
Last active October 31, 2018 19:59
Create angular library in your private npm registry on AzureDevOps
button {
padding: 16px;
background: #2196f3;
color : #fff;
font-size:1.2em;
}
@workfel
workfel / tsconfig-aliases.json
Created October 16, 2018 16:24
import module typescript with aliases
{
"compilerOptions": {
//....
"paths": {
"@auth/*": [
"my_path/auth/*"
],
"@shared/*": [
"shared/*"
],
@workfel
workfel / index.html
Last active October 15, 2018 14:31
nest authentication google by digikare (vuejs)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Nest authentication By Digikare</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.1/socket.io.slim.js"></script>
@workfel
workfel / auth.module-configure.ts
Created October 15, 2018 14:17
nest auth auth.module
export class AuthModule implements NestModule {
public configure(consumer: MiddlewaresConsumer) {
consumer
// Saving the socketId on session
.apply(SessionAuthMiddleware).forRoutes('/auth/google')
// Authenticate to google signin api for /auth/google route
.apply(StrategyMiddleware).with({ provider: 'google' }).forRoutes('/auth/google')
// After signin google call this endpoint
@workfel
workfel / session-auth.middleware.ts
Created October 15, 2018 14:04
nest auth middleware
import { Injectable, NestMiddleware } from '@nestjs/common';
import { ExpressMiddleware } from '@nestjs/common/interfaces/middlewares/express-midleware.interface';
import { NextFunction } from 'express';
@Injectable()
export class SessionAuthMiddleware implements NestMiddleware {
constructor() {
}
async resolve(...args: any[]): Promise<ExpressMiddleware> {
@workfel
workfel / google.strategy.ts
Last active October 15, 2018 14:11
nest auth google strategy
import { Injectable } from '@nestjs/common';
import { OAuth2Strategy } from 'passport-google-oauth';
import * as passport from 'passport';
@Injectable()
export class GoogleStrategy extends OAuth2Strategy {
constructor() {
// http://www.passportjs.org/docs/google/
super({
@workfel
workfel / auth.controller.ts
Created October 15, 2018 13:40
nest auth
@Controller()
export class AuthController {
// The endpoint called from google after signin
@Get('google/callback')
public async googleCallback() {
}
@Get('google')
public async googleSignIn() {
@workfel
workfel / free-font-awesome.json
Created August 7, 2018 08:56
Listing icons font-awesome
{
"version": "1.0.0",
"icons": [
"fa-500px",
"fa-accessible-icon",
"fa-accusoft",
"fa-address-book",
"fa-address-card",
"fa-adjust",
"fa-adn",
@workfel
workfel / karma.conf.js
Created July 25, 2018 07:04
Angular Karma configuration for VSTS with junit & cobertura coverage config
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
process.env.CHROME_BIN = require('puppeteer').executablePath();
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),