Skip to content

Instantly share code, notes, and snippets.

View emanuel-braz's full-sized avatar
🐦
Going down the rabbit hole 🐇 🐇 🐇

Emanuel Braz emanuel-braz

🐦
Going down the rabbit hole 🐇 🐇 🐇
  • Vitat
  • São Paulo, Brazil
View GitHub Profile
@emanuel-braz
emanuel-braz / transform_streams_example.dart
Created March 28, 2023 16:52 — forked from zjor/transform_streams_example.dart
Example of stream debouncing and throttling
import 'dart:async';
import 'dart:math';
import 'package:stream_transform/stream_transform.dart';
StreamController<int> controller = StreamController<int>.broadcast();
void probe(int id, int delay) {
print("Submitted(ID: $id; delay: $delay)");
controller.add(id);
}
@emanuel-braz
emanuel-braz / rxjs-test.js
Created June 13, 2021 17:06 — forked from heat/rxjs-test.js
rxjs operations / subject
const expect = require('chai').expect;
const EventEmitter = require('events');
const rxjs = require('rxjs');
const { ajax } = require('rxjs/ajax');
const { debounce, debounceTime, distinctUntilChanged, switchMap, tap } = require('rxjs/operators');
describe('A emitter', function () {
it('should emit something', async function (done) {
@emanuel-braz
emanuel-braz / spawn.dart
Created May 1, 2020 12:55 — forked from damondouglas/spawn.dart
Dart: Isolate Example [Courtesy: Forian Loitsch]. NOTE: This example is not maintained. Please see https://github.com/dartlang-italia/dart-libraries-samples/tree/master/isolate for a working example.
void echo(SendPort initialReplyTo) {
var port = new ReceivePort();
initialReplyTo(port.sendPort);
port.listen((msg) {
var data = msg[0];
SendPort replyTo = msg[1];
replyTo.send(data);
if (data == "bar") port.close();
});
}
@emanuel-braz
emanuel-braz / convert.dart
Created May 1, 2020 12:48 — forked from damondouglas/convert.dart
Convert MS Word file to Google Drive format.
import 'dart:async';
import 'dart:io';
import 'package:http/http.dart' show Client;
import 'package:googleapis_auth/auth_io.dart' as auth;
import 'package:googleapis/common/common.dart' show Media, DownloadOptions;
import 'package:googleapis/drive/v2.dart' as drive;
import 'package:path/path.dart' as path;
Future convertFile(drive.DriveApi api,
@emanuel-braz
emanuel-braz / readme.md
Created May 1, 2020 12:44 — forked from damondouglas/readme.md
Restore repo from Gitlab bundle file

Gitlab exports repositories to tar archive which contains .bundle files.

We have repo.bundle file and we want to restore files from it.

  • create bare repo from bundle file
git clone --mirror myrepo.bundle my.git