Skip to content

Instantly share code, notes, and snippets.

View matheusmurta's full-sized avatar
👨‍💻
Focusing

Matheus Gonçalves Murta matheusmurta

👨‍💻
Focusing
View GitHub Profile
@matheusmurta
matheusmurta / auth.guard.ts
Created January 31, 2019 13:01
Angular 7 com Json Web Token
import { Injectable } from '@angular/core';
import { CanActivate } from '@angular/router';
import { Observable } from 'rxjs';
import { AuthService } from '../services/auth.service';
@Injectable({
providedIn: 'root'
})
export class AuthGuard implements CanActivate {
@matheusmurta
matheusmurta / user.js
Created February 12, 2019 21:31
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@matheusmurta
matheusmurta / services.ts
Created February 15, 2019 17:01
Angular 7 upload POST HTTP with formData file images
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Event } from '../models/event';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { StorageService } from 'src/app/services/storage.service';
import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root'
})
@matheusmurta
matheusmurta / service.ts
Created February 15, 2019 17:02
Pagseguro Teste Angular 7
import { Injectable, NgZone } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { environment } from 'src/environments/environment';
import { Observable, BehaviorSubject } from 'rxjs';
import { map } from 'rxjs/operators';
import { StorageService } from 'src/app/services/storage.service';
declare var PagSeguroDirectPayment: any;
@matheusmurta
matheusmurta / convert.js
Last active February 15, 2019 17:32
Javascript Convert 'yyyy-mm-ddTHH:mm:ssZ' to 'dd/MM/yyyy HH:mm:ss'
var date = event.event_start;
console.log(date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds());
console.log( event)
var d = event.event_start;
console.log(d.getFullYear()+ "-" + ("00" + (d.getMonth() + 1)).slice(-2) + "-" +("00" + d.getDate()).slice(-2)+" "+ ("00" + d.getHours()).slice(-2) + ":" +("00" + d.getMinutes()).slice(-2) + ":" + ("00" + d.getSeconds()).slice(-2));
// console.log('parte chata', event)
console.log('malucao event', JSON.stringify(event));
@matheusmurta
matheusmurta / scrollbarhide.css
Created March 7, 2019 16:19
Hiding the scrollbar on div
.scroll-wrapper{
overflow-x: scroll;
}
.scroll-wrapper::-webkit-scrollbar {
display: none;
}
<!-- <div>
<select (change)="getServiceForm()" *ngIf="configList$ | async as configList" [(ngModel)]="currentService"
name="serviceRequest">
<option *ngFor="let config of configList" [value]="config.processDefinitionKey">{{config.title}}</option>
</select>
<hr/>
<ng-container *ngIf="currentService">
<start-process (eventId)="onStartProcess()" [processDefinitionKey]="currentService"></start-process>
@matheusmurta
matheusmurta / imed.html
Last active March 29, 2019 19:19
Imed atalhos
<span ng-bind="'action.add' | translate"></span>
title="{{'action.add' | translate}}
ng-bind="'xxxxxx' | translate"
//Modal
openUnsavedChangeModal();
/usr/lib/jvm/java-1.8.0-openjdk/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:45747,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.profiles.active=develop_local -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:/home/imed/Documentos/IDEA/idea-IU-183.5429.30/lib/rt/debugger-agent.jar -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-1.8.0-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-1.8.0-openjdk/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-1.8.0-openjdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-1.8.0-openjdk/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-1.8.0-openjdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-1.8.0-openjdk/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-1.8.0-openjdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-1.8.0-openjdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-1.8.0-openjdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-1.8.0-openjdk/jre/lib/ext/zipfs.jar:/usr/lib
@matheusmurta
matheusmurta / modal-modificado.sass
Last active April 17, 2019 13:04
Imed modal sass modificado exemplo
/home/imed/Documentos/workspace/imedicina-web/js/css/SASS/_custom.sass
.modal-support-channel
padding: 0 !important
left: auto !important
text-align: left
position: fixed
left: auto