Skip to content

Instantly share code, notes, and snippets.

View enapupe's full-sized avatar

Iacami Gevaerd enapupe

View GitHub Profile
@enapupe
enapupe / env-check.js
Last active June 8, 2022 14:31
serverless plugin that will check required environment variables against provided environment variables
'use strict'
const fs = require('fs')
const path = require('path')
const { sync: resolveSync } = require('resolve')
const acornLoose = require('acorn-loose')
const walk = require('acorn-walk')
const resolveImportSourcePathSync = (filePath, importSource) => {
return resolveSync(importSource, {
import axios from 'axios'
import httpAdapter from 'axios/lib/adapters/http'
import { API_URL } from '../src/config/environment'
axios.defaults.host = API_URL
axios.defaults.adapter = httpAdapter
@enapupe
enapupe / .prettierrc
Created March 13, 2018 14:29
my preferred prettier config
{
"printWidth": 100,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"parser": "babylon",
"semi": false,
"arrowParens": "always"
FROM node
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV AUDIO_PATH '/proc/asound/card0/pcm0p/sub0/status'
ENV ENDPOINT_ON 'http://localhost:1880/amp/on'
ENV ENDPOINT_OFF 'http://localhost:1880/amp/off'
COPY . /usr/src/app
[user]
email = enapupe@gmail.com
name = enapupe
[push]
default = current
[core]
excludesfile = ~/.gitignore_global
pager = diff-so-fancy | less --tabs=4 -RFX
editor = subl -n -w
[alias]
var data = {"building": [
{
"volume": 3338.91764606872,
"perimeter": 137.87671346974363,
"points": [
[
78.7396821640909,
106.35271207241327,
0
],
@enapupe
enapupe / tooltip.directive.js
Created November 12, 2014 14:15
AngularJS tooltip directive
angular.module("myApp").directive("theTooltip", function($timeout, $sce){
return {
restrict: "E",
template: "<tooltip-arrow arrow-top></tooltip-arrow><tooltip-content ng-bind-html=\"content\"></tooltip-content><tooltip-arrow></tooltip-arrow>",
link: function(scope, elem, attr){
scope.$on("tooltip.show", function(undefined, newval){
elem.css("visibility", "hidden");
scope.content = $sce.trustAsHtml(newval.content);
// aplicamos o escopo para forçar a renderizacao do novo content
// no tooltip, e assim poder calcular o novo tamanho no próximo
@enapupe
enapupe / reset.js
Created November 6, 2014 11:34
AngularJS auto $setPristine() on reset
angular.module("myApp").directive("form", function(){
return {
require: "^form",
link: function(scope, elem, attr, ctrl){
elem.on("reset", function(){
ctrl.$setPristine();
});
}
};
});
@enapupe
enapupe / controller.js
Created September 29, 2014 15:10
PopUp opener directive for angularjs
"use strict";
myApp.controller("SomeCtrl", function($scope){
$scope.callback = function(){
// do something
};
$scope.url = "http://some/popup";
});
@enapupe
enapupe / autofocus.directive.js
Created September 16, 2014 19:00
Directive that autofocus an element when scope becomes true
myApp.directive("focusMe", function($timeout){
return {
restrict: "A",
link: function(scope, element, attrs){
scope.$watch(attrs.focusMe, function(value){
if(value === true){
$timeout(function(){
element[0].focus();
});
}