Skip to content

Instantly share code, notes, and snippets.

View Gazer's full-sized avatar
💭
Coding

Ricardo Markiewicz Gazer

💭
Coding
View GitHub Profile
@Gazer
Gazer / LazyStaggeredVGrid.swift
Last active August 21, 2023 14:09
SwitftUI Lazy Staggered Vertical Grid
//
// LazyStaggedVGrid.swift
//
// Created by Ricardo Markiewicz on 20/08/2023.
// Copyright © 2023 orgName. No rights reserved.
//
// https://twitter.com/Gazeria/status/1693356336019333382
//
import SwiftUI
@Gazer
Gazer / RecordAudioButton.kt
Created March 20, 2023 18:19
A Composable to record audio
// In the "Data Input"/"Event Output" paradigm, where would you put the Recorder logic?
//
// Leave your comment
//
@OptIn(ExperimentalPermissionsApi::class)
@Composable
fun RecordAudioButton(
onRecordedAudio: (File) -> Unit
) {
var isRecording by remember { mutableStateOf(false) }
@Gazer
Gazer / flaky.sh
Created January 16, 2023 15:08
Run UI test 50 times and record a video only when it fails. Handy to get evidence of Flaky tests.
#!/bin/bash
silent_background() {
{ 2>&3 "$@"& } 3>&2 2>-
disown &>/dev/null # Close STD{OUT,ERR} for silence if job has already completed
}
if [ -z $1 ] ; then
echo "Pass the class name with full package name and the test method name."
echo " "
@Gazer
Gazer / .zshrc
Created July 23, 2020 18:48
Some zsh magic to detect and change the current Flutter version needed by an app in the current directory
# Add this to your ~/.zshrc AFTER the last export PATH="" that is currenttly defined
# Change these to reflect where do you have Flutter installed
export FLUTTER_STABLE_PATH="$HOME/dev/flutter/bin"
export FLUTTER_BETA_PATH="$HOME/dev/flutter-beta/bin"
export FLUTTER_MASTER_PATH="$HOME/dev/flutter-master/bin"
export BASE_PATH=$PATH
# Using 💙 until we can get a Flutter emoji :)
function useFlutterStable() {
@Gazer
Gazer / scroll_expand_container.dart
Created June 5, 2020 14:13
Widget that expand to use full height and if needed can scroll
import 'package:flutter/material.dart';
class ScrollExpandContainer extends StatelessWidget {
final List<Widget> children;
const ScrollExpandContainer({Key key, this.children}) : super(key: key);
@override
Widget build(BuildContext context) {
return LayoutBuilder(
@Gazer
Gazer / main.dart
Created May 20, 2020 23:45
Parse Youtube URL to get YoutubeID
// Parse Youtube URL to get YoutubeID
//
void main() {
var url = "https://www.youtube.com/watch?v=xr3pKzqrv70";
var uri = Uri.parse(url);
var v = uri.queryParameters['v'];
print("v=$v");
}
@Gazer
Gazer / firebase-function-mercadopago.js
Created April 27, 2020 16:30
Create a MercadoPago Preference when a document is created in Firestore
const functions = require('firebase-functions');
const admin = require('firebase-admin');
let FieldValue = require('firebase-admin').firestore.FieldValue;
admin.initializeApp();
const db = admin.firestore();
const express = require('express');
const app = express();
const mercadopago = require('mercadopago');
@Gazer
Gazer / example.dart
Created February 4, 2020 03:12
Flutter Stack Example
class TestWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(24.0),
child: AspectRatio(
aspectRatio: 3 / 2.0,
child: LayoutBuilder(
builder: (context, BoxConstraints constraints) {
return Stack(
@Gazer
Gazer / demo.dart
Created April 25, 2019 17:57
SliderWidget API
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SliderWidget(
icon: Icons.arrow_forward,
text: "Deslizá para transferir",
color: Colors.red,
onSubmit: (Function onFinish, Function onError) async {
await pause(const Duration(seconds: 1));
@Gazer
Gazer / PagerIndicator.java
Created September 19, 2016 11:53
A simple Page indicator for Android ViewPager
package com.example;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Build;
import android.support.v4.view.ViewPager;