Skip to content

Instantly share code, notes, and snippets.

View JaredEzz's full-sized avatar

Jared Ezzet Hasson JaredEzz

View GitHub Profile
@JaredEzz
JaredEzz / fl_dot_line_segment_painter.dart
Created April 24, 2024 05:30
FlDotLineSegmentPainter
/// This class is an implementation of a [FlDotPainter] that draws
/// a line segment with a value label above it.
class FlDotLineSegmentPainter extends FlDotPainter {
/// Constructs a [FlDotLineSegmentPainter].
FlDotLineSegmentPainter({
required this.width,
required this.height,
required this.value,
required this.textColor,
this.color = Colors.blue,
@JaredEzz
JaredEzz / index.js
Last active September 1, 2023 17:14
firestore-backup v2 cloud function
const functions = require('@google-cloud/functions-framework');
const firestore = require('@google-cloud/firestore');
const client = new firestore.v1.FirestoreAdminClient();
const bucket = 'gs://[bucket-name]'
// Register a CloudEvent callback with the Functions Framework that will
// be executed when the Pub/Sub trigger topic receives a message.
functions.cloudEvent('firestore-backup', cloudEvent => {
const databaseName = client.databasePath(
"[project-id]",
'(default)'
@JaredEzz
JaredEzz / ClearCollections.java
Created January 24, 2023 20:39
Clear all Firebase Cloud Firestore Collections
import com.google.api.core.ApiFuture;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.cloud.firestore.CollectionReference;
import com.google.cloud.firestore.Firestore;
import com.google.cloud.firestore.QueryDocumentSnapshot;
import com.google.cloud.firestore.QuerySnapshot;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
import com.google.firebase.cloud.FirestoreClient;
@JaredEzz
JaredEzz / saveResultsResponse.json
Created February 10, 2022 00:06
Example Response for Save Results
{
"results": {
"ID.AM-PHYSICAL-COVERAGE": {
"score": 0
}
},
"scores": {
"geWfuH1htzZnffWn3Hpv": {
"A.ID": {
"score": 74,
@JaredEzz
JaredEzz / getResultsResponse.json
Created February 9, 2022 23:58
Example Response for GetResults
{
"scores": {
"geWfuH1htzZnffWn3Hpv": {
"A.ID": {
"score": 80,
"target": 69,
"weight": 97000,
"weight-max": 117000,
"weight-min": 24000,
"weight-sum": 340000
@JaredEzz
JaredEzz / getUnitsResponse.json
Last active February 9, 2022 23:53
Example Response for GetUnits
{
"2CII1MrN7b62qmkhhM6w": {
"assessment-bu": true,
"assessment-taker": false,
"name": "Target Testing Division 1",
"period-time-frame": "monthly",
"periods": [
"202201"
],
"targets": true
@JaredEzz
JaredEzz / setCurrentBusinessUnit.json
Created February 9, 2022 15:25
Example Response for SetCurrentBusinessUnit
{
"scores": {
"geWfuH1htzZnffWn3Hpv": {
"A.ID": {
"score": 77,
"target": 66,
"weight": 95000,
"weight-max": 117000,
"weight-min": 24000,
"weight-sum": 338000
@JaredEzz
JaredEzz / setCurrentPeriodResponse.json
Created February 9, 2022 15:06
Example Response for SetCurrentPeriod
{
"results": {},
"scores": {
"geWfuH1htzZnffWn3Hpv": {
"A.ID": {
"score": 77,
"target": 66,
"weight": 95000,
"weight-max": 117000,
"weight-min": 24000,
@JaredEzz
JaredEzz / GumballMachineTest.java
Created September 11, 2020 22:17
Tests for Beto to not be paranoid 😳
package tech.jaredhasson;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static org.junit.jupiter.api.Assumptions.assumingThat;