Skip to content

Instantly share code, notes, and snippets.


Leonardo CavalcanteLeo

View GitHub Profile
maoosi / amplifyauth-scheme.ts
Last active Sep 24, 2021
[WIP] Custom amplify auth scheme for nuxt/auth (
View amplifyauth-scheme.ts
import { Amplify, Auth, withSSRContext } from 'aws-amplify'
import { Auth as NuxtAuth } from '@nuxtjs/auth-next'
export interface AmplifyAuthSchemeOptions {
name: string
export default class AmplifyAuthScheme {
public $auth: NuxtAuth
public options: AmplifyAuthSchemeOptions
gauravssnl / build-and-release.yml
Created Mar 9, 2020 — forked from devhammed/build-and-release.yml
GitHub Actions workflow to build Flutter app and create Release, put this file under `.github/workflows` folder.
View build-and-release.yml
- master
name: Build and Release Apps
name: Build Apps
runs-on: macos-latest
flar / cached_frosted_backdrop.dart
Created Jan 4, 2020
Blurring a background with either a cached BackdropFilter or an ImageFiltered widget for comparison.
View cached_frosted_backdrop.dart
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
View fancy-background-app.dart
class FancyBackgroundApp extends StatelessWidget {
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
Positioned.fill(child: AnimatedBackground()),
height: 180,
speed: 1.0,
timdown / range_selection_save_restore.js
Last active Feb 24, 2021
Range and selection marker-element-based save and restore
View range_selection_save_restore.js
* This is ported from Rangy's selection save and restore module and has no dependencies.
* Copyright 2019, Tim Down
* Licensed under the MIT license.
* Documentation:
* Use "rangeSelectionSaveRestore" instead of "rangy"
var rangeSelectionSaveRestore = (function() {
var markerTextChar = "\ufeff";
Meuss / get-page-content.js
Last active Oct 2, 2020
cloudinary / wp / nuxt images sizes example
View get-page-content.js
export default {
data() {
return {
data: null,
loaded: false,
methods: {
getPageContent(id) {
themikefuller / aes-gcm.js
Created Oct 15, 2018
AES-GCM Encryption and Decryption Examples using Web Crypto (subtle.crypto) JavaScript API
View aes-gcm.js
async function generateKey() {
return await crypto.subtle.generateKey({
async function exportKey(key) {
return await crypto.subtle.exportKey('jwk', key);
Guichaguri /
Last active Sep 9, 2021
Consulta CNPJ e CEP - Javascript

Consulta de CNPJ e CEP em Javascript (Web ou NodeJS)

Funções para consultar informações sobre CNPJ e CEP pela web (sem backend necessário) ou através de Node.JS

  • nodejs-lib.js - Código para realizar a requisição através do módulo de HTTPS do Node.JS
  • web-lib.js - Código para realizar a requisição através de JSONP na Web
  • consulta.js - Funções para realizar consultas de CNPJ e CEP

Se você está usando Node.JS, adicione o código de nodejs-lib.js.

virolea / upload.js
Last active Sep 26, 2021
Tracking file upload progress using axios
View upload.js
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) /
let data = new FormData()
data.append('file', files[0])
fgilio / axios-catch-error.js
Last active Sep 16, 2021
Catch request errors with Axios
View axios-catch-error.js
* Handling Errors using async/await
* Has to be used inside an async function
try {
const response = await axios.get('');
// Success 🎉
} catch (error) {
// Error 😨