Skip to content

Instantly share code, notes, and snippets.

@Adrek
Adrek / types.ts
Created May 3, 2021 01:04 — forked from danirod/types.ts
Algo que he aprendido hoy sobre tipos en TypeScript.
/**********************************************************
* COSAS SIMPLES CON TIPOS PARA IR ABRIENDO BOCA.
*********************************************************/
/* Una interfaz que maneja datos en una agenda de contactos. */
interface Person {
/* Datos personales sobre esta persona. */
name: string;
age: number;
city: string;
@Adrek
Adrek / dio_api_helper.dart
Created February 24, 2021 16:18 — forked from RyanDsilva/dio_api_helper.dart
Flutter Dio Helper Class
import 'package:dio/dio.dart';
class ApiBaseHelper {
static final String url = 'BASE_URL';
static BaseOptions opts = BaseOptions(
baseUrl: url,
responseType: ResponseType.json,
connectTimeout: 30000,
receiveTimeout: 30000,
);
@Adrek
Adrek / debouncer.dart
Created February 7, 2021 13:18 — forked from Klerith/debouncer.dart
Dart: Debouncer
import 'dart:async';
// Creditos
// https://stackoverflow.com/a/52922130/7834829
class Debouncer<T> {
Debouncer({ this.duration, this.onValue });
final Duration duration;
void Function(T value) onValue;
@Adrek
Adrek / portainer.md
Created October 18, 2020 18:21 — forked from SeanSobey/portainer.md
Portainer Setup on Windows 10

Portainer on Windows 10

Here I have 2 methods for running portainer on windows, a quick, preferred method only requiring a fairly recent version of docker, or a more complicated method to try if that does not work.

Using docker.for.win.localhost

This setup will let you run Portainer on windows by using the docker.for.win.localhost endpoint.

Please note:

@Adrek
Adrek / slim-stream-route.php
Last active June 4, 2020 19:26 — forked from james2doyle/slim-stream-route.php
Create a streaming download of a large file with Slim PHP using the build in Stream class
<?php
use Slim\Http\Request;
use Slim\Http\Response;
use Slim\Http\Stream;
$app->get('/stream', function (Request $request, Response $response, array $args) {
// a 100mb file
$path = '../public/files/document.pdf';
@Adrek
Adrek / plugins.md
Created February 16, 2020 11:59 — forked from Klerith/plugins.md
Flutter: Curso de Flutter - Instalaciones recomendadas
@Adrek
Adrek / jwt-payload-parse.dart
Created November 23, 2019 16:52 — forked from hjJunior/jwt-payload-parse.dart
Get payload of JWT token in Dart language
import 'dart:convert';
Map<String, dynamic> parseJwt(String token) {
final parts = token.split('.');
if (parts.length != 3) {
throw Exception('invalid token');
}
final payload = _decodeBase64(parts[1]);
final payloadMap = json.decode(payload);