Skip to content

Instantly share code, notes, and snippets.

♥️
Python, Javascript, and Go

Gui Talarico gtalarico

♥️
Python, Javascript, and Go
Block or report user

Report or block gtalarico

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gtalarico
gtalarico / netlify.toml
Created Jun 7, 2019
Netlify toml Config
View netlify.toml
# netlify.toml
[build]
functions = "build-lambda"
publish = "dist/"
command = "yarn build"
@gtalarico
gtalarico / vue.config.js
Last active Jun 7, 2019
Netlify Function Vue Config
View vue.config.js
// vue.config.js
module.exports = {
devServer: {
proxy: {
'^/.netlify': {
target: 'http://localhost:9000',
pathRewrite: { '^/.netlify/functions': '' }
}
}
}
@gtalarico
gtalarico / lambdaService.js
Created Jun 7, 2019
Netlify Lambda Service
View lambdaService.js
// lambdaService.js
import axios from 'axios'
const $axios = axios.create({
baseURL: '/.netlify/functions',
timeout: 10000 // 10 seconds
})
// Response Interceptor to handle and log errors
$axios.interceptors.response.use(
@gtalarico
gtalarico / packages.json
Last active Jun 7, 2019
Netlify Functions Build
View packages.json
{
"scripts": {
"serve": "vue-cli-service serve",
"serve:lambda": "netlify-lambda serve lambda",
"build": "run-p build:**",
"build:app": "vue-cli-service build",
"build:lambda": "netlify-lambda build lambda",
"...": "..."
},
@gtalarico
gtalarico / airtable.js
Last active Jun 7, 2019
Airtable Netlify Lambda Function Setup
View airtable.js
// lambda/airtable.js
const Airtable = require('airtable')
Airtable.configure({
endpointUrl: 'https://api.airtable.com',
apiKey: process.env.AIRTABLE_KEY
})
const base = Airtable.base('appNtnZ99fkL1cByn')
exports.handler = function(event, context, callback) {
@gtalarico
gtalarico / assert_envs.sh
Created May 23, 2019
Assert Environment Variables are set
View assert_envs.sh
# Asserts given env vars are set
# Usage: assert_envs { args }
# eg. DBHOST DBPORT DBNAME DBUSER
assert_envs() {
for var in "$@"; do
if [ -z "${!var}" ]; then
error "$var environment is required and is not set"
exit 1
fi
done
@gtalarico
gtalarico / serve.sh
Created May 12, 2019
Django Database is Read
View serve.sh
info " Checking DB Connection"
while ! python3 manage.py inspectdb >/dev/null 2>&1; do
warn " DB is not ready"
sleep 5
done
info " DB is ready"
@gtalarico
gtalarico / fuck-docker.sh
Created Apr 5, 2019
For when you docker is misbehaving
View fuck-docker.sh
#!/bin/bash
# By Andrew Salveson
docker rm -v $(docker ps -a -q -f status=exited)
docker rmi $(docker images -f "dangling=true" -q)
docker volume rm $(docker volume ls -qf dangling=true)
cat <<EOF
@gtalarico
gtalarico / OrbitControls.js
Last active Mar 21, 2019
threejs-vue-template-2
View OrbitControls.js
// src/three/OrbitControls.js
// Note: file content truncated for display
// Be sure to include the entire content from
// https://raw.githubusercontent.com/mrdoob/three.js/master/examples/js/controls/OrbitControls.js
/**
* @author qiao / https://github.com/qiao
* @author mrdoob / http://mrdoob.com
* @author alteredq / http://alteredqualia.com/
* @author WestLangley / http://github.com/WestLangley
@gtalarico
gtalarico / App.vue
Created Mar 21, 2019
three-vue-template-1
View App.vue
<template>
<div id="app">
<navbar />
<router-link to="/">Home</router-link>
</div>
</template>
<script>
import Navbar from '@/components/Navbar.vue'
export default {
You can’t perform that action at this time.