Skip to content

Instantly share code, notes, and snippets.

@CITguy
CITguy / custom-task.js
Last active January 13, 2023 19:23
Basic pattern for creating a custom Transform stream for use with gulp tasks.
var gulp = require('gulp');
var myTransform = require('./myTransform');
gulp.task('foobar', function (){
return gulp.src("foobar.js")
.pipe(myTransform())
.pipe(gulp.dest('.'));
});
@olegcherr
olegcherr / simpleMeasureTest.kt
Last active May 14, 2022 10:21
Simple Kotlin micro-benchmarking tool (Android supported)
package azagroup.test
import java.util.ArrayList
/**
* Iterates provided by [callback] code [ITERATIONS]x[TEST_COUNT] times.
* Performs warming by iterating [ITERATIONS]x[WARM_COUNT] times.
*/
fun simpleMeasureTest(
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active November 18, 2024 13:32
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@joaocruz04
joaocruz04 / android_room_fts4.md
Last active May 21, 2024 04:40
Enabling FTS4 on an Android + Room project

Enabling FTS4 on an Android project with Room

You can do a SQL text query by using the LIKE operator. The issue is that using it requires a lot of computation, as a complete string query is done. Also if you want to have more search options (more fields), your query will grow a lot in complexity. To solve this issue, there's a concept of virtual tables for full text search (FTS).

We will build our solution using Room (already set in the project). We're using version 2.2.0-rc01 for that.

Step 1 - Create new Virtual Table

With Room, the only thing we need is to create the new class with @FTS4 notation. By specifying contentEntity to be the Route class, it means that it will reuse the values from the Route table instead of populating this one with copies. The fields in question should match the ones from the Route table. In this example we only need the title.

@alexanderbazo
alexanderbazo / build.yml
Created December 6, 2019 16:07
Github Actions: Build and Release Android-APK
name: Minimal Android CI Workflow
on:
push:
branches:
- master
tags:
- 'v*'
jobs:
@florina-muntenescu
florina-muntenescu / build.gradle.kts
Created July 2, 2021 15:29
Proto DataStore config in Gradle Kotlin DSL
/* Copyright 2021 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
import com.google.protobuf.gradle.*
plugins {
// find latest version number here:
// https://mvnrepository.com/artifact/com.google.protobuf/protobuf-gradle-plugin
id("com.google.protobuf") version "0.8.16"
...