Skip to content

Instantly share code, notes, and snippets.

Avatar
🙃

Leonardo CavalcanteLeo

🙃
View GitHub Profile
@maoosi
maoosi / amplifyauth-scheme.ts
Last active Sep 24, 2021
[WIP] Custom amplify auth scheme for nuxt/auth (auth.nuxtjs.org).
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
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
on:
push:
branches:
- master
name: Build and Release Apps
jobs:
build:
name: Build Apps
runs-on: macos-latest
@flar
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 {
@override
View fancy-background-app.dart
class FancyBackgroundApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
Positioned.fill(child: AnimatedBackground()),
onBottom(AnimatedWave(
height: 180,
speed: 1.0,
)),
@timdown
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: https://github.com/timdown/rangy/wiki/Selection-Save-Restore-Module
* Use "rangeSelectionSaveRestore" instead of "rangy"
*/
var rangeSelectionSaveRestore = (function() {
var markerTextChar = "\ufeff";
@Meuss
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) {
this.$axios
@themikefuller
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({
"name":"AES-GCM",
"length":256
},true,['encrypt','decrypt']);
}
async function exportKey(key) {
return await crypto.subtle.exportKey('jwk', key);
}
@Guichaguri
Guichaguri / Consulta-CNPJ-CEP.md
Last active Sep 9, 2021
Consulta CNPJ e CEP - Javascript
View Consulta-CNPJ-CEP.md

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
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) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
@fgilio
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('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨