Skip to content

Instantly share code, notes, and snippets.

View ggondim's full-sized avatar
Building a more reusable JavaScript ecosystem

Gustavo Gondim ggondim

Building a more reusable JavaScript ecosystem
View GitHub Profile
@ggondim
ggondim / index.html
Last active September 17, 2015 06:27 — forked from anonymous/index.html
An Angular.js playground to play with promises. // source http://jsbin.com/yecedi
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
</head>
<body>
<script id="jsbin-javascript">
var $q = angular.injector(['ng']).get('$q');
var $timeout = angular.injector(['ng']).get('$timeout');
function teste() {
@ggondim
ggondim / DependencyResolver.cs
Last active March 26, 2016 03:02
A simple and quick DI container and resolver with Singleton and Transient lifecycles.
// DependencyResolver
// A simple and quick DI container and resolver with Singleton and Transient lifecycles.
// Copyright © 2016 Gustavo Gondim (https://github.com/ggondim)
// Licensed under Creative Commons 3.0 BY
// Instructions:
// - Replace <%namespace%> with your application's namespace.
// - Register instances in DependencyResolver constructor.
// - Split enums and classes into separate files if you want to a better project organization.
function permutation(collection) {
let current;
let result = [];
const currentArray = [];
const newResultArray = [];
if (collection.length) {
current = collection.shift();
result = permutation(collection);
@ggondim
ggondim / .hyper.js
Last active December 26, 2018 21:30
My Hyper (https://github.com/zeit/hyper) settings using hyper-sync-settings plugin (https://www.npmjs.com/package/hyper-sync-settings)
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
opacity: 0.95,
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
@ggondim
ggondim / proxies.json
Created April 21, 2019 00:21
Azure Function proxy para o site de vagas da NOALVO
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {
"listar vagas": {
"matchCondition": {
"route": "/listarvagas"
},
"backendUri": "https://api.airtable.com/v0/IDDASUABASEAQUI/Vagas?fields%5B%5D=T%C3%ADtulo&fields%5B%5D=Imagem&fields%5B%5D=slug&filterByFormula=%7BStatus%7D%3D%22Aberta%22",
"requestOverrides": {
"backend.request.headers.Authorization": "Bearer SUACHAVEAQUI"
@ggondim
ggondim / extensions.js
Created August 12, 2019 19:24
List vscode extensions with name, URL and description!
const path = require('path');
const fs = require('fs');
const defaultExtensionsPath = 'C:\\Users\\<YOURUSERFOLDERIFYOUUSEWINDOWS>\\.vscode\\extensions\\';
const isDirectory = source => fs.lstatSync(source).isDirectory()
const getDirectories = source =>
fs.readdirSync(source).map(name => path.join(source, name)).filter(isDirectory)
async function main() {
const extensions = getDirectories(defaultExtensionsPath);
@ggondim
ggondim / README.md
Created May 18, 2020 23:31
Airtable schema API request

Airtable Schema API

Replace the variables below in the script

  • YOURBASEID: your Airtable base ID starting with 'app...'
  • YOURCOOKIESFORAIRTABLEDOMAIN your browser cookie for airtable.com domain
@ggondim
ggondim / index.js
Last active June 17, 2020 23:44
Azure Monofunction example - Function script
const app = require('azure-monofunction');
const routes = [{
path: '/example/:param',
methods: ['GET', 'PUT'],
run: async (context) => {
context.res.body = { it: 'works' };
},
}]
@ggondim
ggondim / function.json
Created June 17, 2020 23:45
Azure Monofunction example - Function trigger
{
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"route": "{*segments}"
},
{
@ggondim
ggondim / function.js
Created June 17, 2020 23:56
Function Blend Anti-Pattern
async function entryPoint(context) {
if (context.req.method === 'GET') {
// it is a "get single resource" operation
} else if (context.req.method === 'PUT') {
// it is a "replace resource" operation
} else {
// must respond with 403 forbidden or not supported
}
}