#GIT
- Modificado (modified);
- Preparado (staged/index)
- Consolidado (comitted);
# https://developer.spotify.com/console/get-current-user-saved-tracks | |
$token="<Your Token>" | |
# API limits 50 tracks per request, so I paginate my 1100+ musics here | |
for i in `seq 0 50 1300`; | |
do curl -k -X "GET" "https://api.spotify.com/v1/me/tracks?limit=50&offset=$i" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $token" >> musics.json; | |
done; |
<?xml version="1.0" encoding="UTF-8"?> | |
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> | |
<persistence-unit name="h2" transaction-type="JTA"> | |
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> | |
<properties> | |
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" /> | |
<property name="hibernate.connection.driver_class" value="org.h2.Driver" /> | |
<property name="hibernate.hbm2ddl.auto" value="update" /> |
@RequestMapping(value = "/runJobAndGetLogs", method = RequestMethod.GET) | |
public ResponseEntity<StreamingResponseBody> runJobAndGetLogs() throws IOException { | |
final InputStream inputStream = someService.runJobAndGetReportProgress(); | |
StreamingResponseBody body = StreamingResponseBody body = (outputStream) -> { | |
try (BufferedInputStream br = new BufferedInputStream(inputStream)) { | |
// just copying to the outputstream | |
byte[] contents = new byte[1024]; | |
int bytesRead = 0; | |
while ((bytesRead = br.read(contents)) != -1) { |
import { | |
AfterContentInit, Directive, ElementRef, EventEmitter, Inject, Input, OnDestroy, Output, PLATFORM_ID, | |
Renderer2 | |
} from "@angular/core"; | |
import {isPlatformBrowser} from "@angular/common"; | |
@Directive({ | |
selector: '[image-loader]' | |
}) | |
export class ProgressiveImageLoaderDirective implements AfterContentInit, OnDestroy { |
private ObjectMapper jsonMapper = new ObjectMapper(); | |
private ExecutorService executorService = Executors.newFixedThreadPool(5); | |
@Async | |
public ListenableFuture<Boolean> export(UUID customerId) { | |
try (PipedInputStream in = new PipedInputStream(); | |
PipedOutputStream pipedOut = new PipedOutputStream(in); | |
GZIPOutputStream out = new GZIPOutputStream(pipedOut)) { | |
Stopwatch stopwatch = Stopwatch.createStarted(); |
import org.springframework.amqp.core.Binding; | |
import org.springframework.amqp.core.BindingBuilder; | |
import org.springframework.amqp.core.DirectExchange; | |
import org.springframework.amqp.core.Queue; | |
import org.springframework.amqp.rabbit.connection.ConnectionFactory; | |
import org.springframework.amqp.rabbit.core.RabbitTemplate; | |
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; | |
import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; |
First of all, please note that token expiration and revoking are two different things.
A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.
Quoted from JWT RFC:
## Apiary | |
# API Blueprint Cheat Sheet | |
[API Blueprint](http://apiblueprint.org)(.apib) - API description format, plain text, Markdown-like. | |
## API Blueprint Document Structure | |
![](./api-blueprint-cheatsheet-image.png) |
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; | |
import { forwardRef, Type } from '@angular/core'; | |
/** | |
* Function to create the basic provider to components which use `ngModel` as required by Angular. | |
* @param type component type which extends `SimpleControlValueAcessor` | |
*/ | |
export function createProviders(type: Type<SimpleControlValueAcessor>) { | |
return [ | |
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => type), multi: true } |