Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@yungwarlock
yungwarlock / main.dart
Last active September 4, 2023 13:26
SchedulerBinding
import 'package:flutter/material.dart';
import "package:flutter/scheduler.dart";
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@yungwarlock
yungwarlock / main.dart
Last active June 26, 2023 14:24
Dart Timer
import 'dart:async';
void main() {
int countDown = 60;
bool shouldShowResend = false;
Timer.periodic(const Duration(seconds: 1), (t) {
print(formatTime(countDown));
print(shouldShowResend);
});
@atrauzzi
atrauzzi / google-cloud-run-get-project-hash.sh
Last active May 25, 2023 00:41
Google Cloud Run Get Project Hash
#!/bin/bash
PROJECT=${1:-"$(gcloud config get-value project)"}
REGION=${2:-"us-central1"}
IMAGE="hub.docker.com/_/nginx"
{
gcloud services enable "run.googleapis.com" --project="${PROJECT}"
gcloud auth configure-docker --quiet
@coryodaniel
coryodaniel / list.txt
Created May 13, 2020 22:04
GCP List of API Services
NAME TITLE
abusiveexperiencereport.googleapis.com Abusive Experience Report API
acceleratedmobilepageurl.googleapis.com Accelerated Mobile Pages (AMP) URL API
accessapproval.googleapis.com Access Approval API
accesscontextmanager.googleapis.com Access Context Manager API
actions.googleapis.com Actions API
adexchangebuyer-json.googleapis.com Ad Exchange Buyer API
adexchangebuyer.googleapis.com Ad Exchange Buyer API II
adexchangeseller.googleapis.com Ad Exchange Seller API
adexperiencereport.googleapis.com Ad Experience Report API
@prokizzle
prokizzle / ExampleComponent.js
Last active July 14, 2021 00:55
useFeatureFlag Example
import React from 'react';
import useFeatureFlag from './useFeatureFlag';
import RecommendationsComponent from './Recommendations.js';
const {
DecoratedComponent: Recommendations,
featureEnabled: recommendationsFeatureEnabled,
FeatureFlag
} = useFeatureFlag({
Component: RecommendationsComponent,
@ycherniavskyi
ycherniavskyi / main.dart
Created December 28, 2019 15:25
Displaying notification badge on BottomNavigationBar's Icon
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
@michal-wrzosek
michal-wrzosek / api.Dockerfile
Created December 3, 2019 02:05
yarn workspaces and Docker
FROM node:10-alpine as build
WORKDIR /usr/src/app
COPY package.json .
COPY yarn.lock .
COPY packages/shared ./packages/shared
COPY packages/api ./packages/api
RUN yarn install --pure-lockfile --non-interactive
@CarlosDomingues
CarlosDomingues / python-poetry-cheatsheet.md
Last active April 22, 2024 09:28
Python Poetry Cheatsheet

Create a new project

poetry new <project-name>

Add a new lib

poetry add <library>

Remove a lib

@ankjevel
ankjevel / clear-cache.sh
Last active April 18, 2024 08:31
clear npm cache (when using nvm); run with `nvm list | clear-cache`
#!/usr/bin/env bash
function clear-cache {
versions=()
while read -r line; do
clean="$(echo ${line} | sed "s,$(printf '\033')\\[[0-9;]*[a-zA-Z],,g")"
valid=$(echo "${clean}" | grep '^[^a-zA-Z]' | grep -v 'system' | sed 's/->//' | sed 's/\s.*v//')
if [[ ! -z $valid ]]; then
versions+=(${valid})
@lmcarreiro
lmcarreiro / .gitlab-ci.yml
Created June 11, 2018 13:36
GitLab CI .gitlab-ci.yml example
stages:
- build
- test
- deploy
variables:
# from https://storage.googleapis.com/kubernetes-release/release/stable.txt
K8S_STABLE_VERSION_URL: https://storage.googleapis.com/kubernetes-release/release/v1.10.4/bin/linux/amd64/kubectl
build: