Skip to content

Instantly share code, notes, and snippets.

View renancaraujo's full-sized avatar
🦡
capybaras are delicious

Renan renancaraujo

🦡
capybaras are delicious
View GitHub Profile
@renancaraujo
renancaraujo / README.md
Last active August 7, 2024 16:50
Aurora borealis card in Flutter using mesh gradients

Aurora Boeralis card that varies size according to mouse position

Screenshot

@renancaraujo
renancaraujo / comet1.mehs
Last active August 13, 2023 15:56
meshes
789ce360b3657bbcc8f6d4445576bb355a497689a76339ec55b81cedf2b8df72dbb56c4cb63b57a7c163aff228df5e416d1aafbde987627b8edb2b04eccea65bd82b9e4b17b4175c1760ef901cc9c8f3ffffbbfbff252525ff5b3004fd676536f8bf92c19dc7cee7cc591006008a42275a
import 'dart:math';
void main() {
print(gcd([144, 96, -24, -1200, 671]));
}
int gcd(List<int> els) {
final minF = els.reduce((a, b) {
assert(b != 0, "element cannot be zero");
return min(a, b.abs());
});
@renancaraujo
renancaraujo / computed_value_notifier.dart
Last active July 19, 2021 18:43
computed_value_notifier.dart
import 'package:flutter/foundation.dart';
typedef ValueComputation<T, O> = T Function(O value);
class ComputedValueNotifier<T> extends ValueNotifier<T> {
final Listenable _parent;
final ValueGetter<T> _compute;
factory ComputedValueNotifier.fromListenable(
Listenable notifier,
import { IOfferJson, IDType, IntervalType } from '@/interfaces/Offer';
interface ICreditCardInfo {
installmentsNumber: number;
installmentsPrice: number;
discountPercentage: number;
isVisible: boolean;
paramToDisplay?: string;
isActive: boolean;
}
class TRexGame extends BaseGame{
TRex tRex;
Horizon horizon;
GameOverPanel gameOverPanel;
TRexGameStatus status = TRexGameStatus.waiting;
double currentSpeed = GameConfig.speed;
TRexGame({
Runner.prototype.scheduleNextUpdate = function () {
if (!this.updatePending) {
this.updatePending = true;
this.raqId = requestAnimationFrame(this.update.bind(this));
}
},
Runner.prototype.update = function () {
this.updatePending = false;
var now = getTimeStamp();
var deltaTime = now - (this.time || now);
this.time = now;
if (this.playing) {
this.clearCanvas();
/** only executes the last callback sent of a unique id**/
const finalTimeout = (function() {
const timers = {};
return function(callback, ms, uniqueId) {
if (!uniqueId) {
uniqueId = 'default';
}
if (timers[uniqueId]) {
window.clearTimeout(timers[uniqueId]);
}
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:math' as math;
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/gestures.dart';
import 'gesture_tester.dart';
void main() {