Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View renatoathaydes's full-sized avatar

Renato Athaydes renatoathaydes

View GitHub Profile
@renatoathaydes
renatoathaydes / MyFunctions.groovy
Created January 20, 2024 21:08
Example code sharing in Gradle
// add this to buildSrc/src/main/groovy/foo/MyFunctions.groovy
package foo
class MyFunctions {
static String hello() { 'hello' }
}
@renatoathaydes
renatoathaydes / kate.shortcuts
Created January 15, 2024 13:09
Kate keyboard shortcuts on MacOS
[Shortcuts]
Next Editing Line=Ctrl+Shift+E
Previous Editing Line=Ctrl+E
add_bom=none
backspace=Backspace; Shift+Backspace
beginning_of_document=Ctrl+Home
beginning_of_line=Meta+A; Ctrl+Num+Left
bookmarks_clear=none
bookmarks_next=Alt+PgDown
bookmarks_previous=Alt+PgUp
@renatoathaydes
renatoathaydes / chart.svg
Created January 14, 2024 15:51
DLang - comparison with Java, Rust and Common Lisp
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@renatoathaydes
renatoathaydes / gist:fd8752ed81b0cf792ed7ef5aa3d68acd
Created January 13, 2024 12:50
trace.log (DLang profiler from dencoder)
------------------
1009 _D3std10functional__T6safeOpVAyaa1_3cZ__TQuTmTiZQBbFNaNbNiNfKmKiZb
_D3std10functional__T6safeOpVAyaa1_3cZ__T8unsafeOpTmTiZQoFNaNbNiNfmiZb 1009 946 946
------------------
52214 _D3std10functional__T6safeOpVAyaa1_3cZ__TQuTyiTmZQBcFNaNbNiNfKyiKmZb
_D3std10functional__T6safeOpVAyaa1_3cZ__T8unsafeOpTyiTmZQpFNaNbNiNfyimZb 52214 6329 6329
------------------
1009 _D3std9algorithm10comparison__T3maxTmTiZQjFNaNbNiNfmiZm
_D3std10functional__T6safeOpVAyaa1_3cZ__TQuTmTiZQBbFNaNbNiNfKmKiZb 1009 2184 1238
1009 _D3std10functional__T6safeOpVAyaa1_3cZ__T8unsafeOpTmTiZQoFNaNbNiNfmiZb
@renatoathaydes
renatoathaydes / main.dart
Created August 23, 2022 11:11
Dart - processing stream of JSON documents
import 'dart:convert';
main() async {
const jsons = '{"foo": "Ø"}\n{"bar": false}';
final bytes = utf8.encode(jsons);
// partitions breaking the bytes between invalid UTF-8 boundaries
final partitions =
Stream.fromIterable([bytes.sublist(0, 10), bytes.sublist(10)]);
@renatoathaydes
renatoathaydes / README.md
Created January 20, 2022 10:36
Typescript api-extractor bug

This project demonstrates a problem with api-extractor.

My objective is the following:

  • I have a Typescript file which defines a basic API.
  • I want this file to be used for generating a declarations TS file (.d.ts file).
  • I don't want to generate actual JS files as those are not relevant.
  • Use the .d.ts file to generate markdown docs for my API.

The source file is in the ts-project directory, so I tell tsc:

@renatoathaydes
renatoathaydes / Scracth.java
Created December 21, 2021 17:11
Demonstration of how Java async methods are misleading, at best.
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executors;
class Scratch {
public static void main(String[] args) throws Exception {
var singleThreadedExecutor = Executors.newSingleThreadExecutor();
var startTime = System.currentTimeMillis();
/*
@renatoathaydes
renatoathaydes / gist:1d59b1a93d83e97774bbc4fd8cd62929
Created December 16, 2021 07:23
Log4j2-core jar jdeps output
▶ jdeps --multi-release 11 out/log4j-core-2.16.0.jar
log4j-core-2.16.0.jar -> java.base
log4j-core-2.16.0.jar -> java.compiler
log4j-core-2.16.0.jar -> java.desktop
log4j-core-2.16.0.jar -> java.logging
log4j-core-2.16.0.jar -> java.management
log4j-core-2.16.0.jar -> java.naming
log4j-core-2.16.0.jar -> java.rmi
log4j-core-2.16.0.jar -> java.scripting
log4j-core-2.16.0.jar -> java.sql
@renatoathaydes
renatoathaydes / main.dart
Created December 4, 2021 10:25
Skyline problem implementation in Flutter. Based on https://briangordon.github.io/2014/08/the-skyline-problem.html
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import 'dart:math' as math;
void main() => runApp(MyApp());
class Rectangle {
@renatoathaydes
renatoathaydes / Test.java
Last active October 24, 2021 08:36
Using static variables in local scope in Java.
import java.util.regex.Pattern;
public class Test {
public static void main(String[] args) {
check("a");
check("b");
}
static Pattern compile(String pattern) {
System.out.println("compile(" + pattern + ")");