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, {
@enapupe
enapupe / autogrow.js
Last active February 8, 2021 11:26
Auto Grow/Shrink textarea directive for AngularJS (credits to this gist https://gist.github.com/thomseddon/4703968, specially @huyttq)
angular.module("myApp").directive("autoGrow", function(){
return function(scope, element, attr){
var update = function(){
element.css("height", "auto");
var height = element[0].scrollHeight;
if(height > 0){
element.css("height", height + "px");
}
};
scope.$watch(attr.ngModel, function(){
@enapupe
enapupe / GAnalytics.php
Last active March 14, 2019 13:45
Google Analytics API interface for Code Igniter
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* GAnalytics - Google Analytics PHP Interface for Code Igniter
* Uses google php api https://github.com/google/google-api-php-client
*
* Support material:
* How to set-up the app and configure the analytics profile http://stackoverflow.com/a/10089698/1666071
* Analytics query explorer http://ga-dev-tools.appspot.com/explorer/
*
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
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
@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"
[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 / functions.php
Created September 26, 2013 13:36
functions.
<?php
ob_settings_config {
var $group = "enapupe"; // defines setting groups (should be bespoke to your settings)
var $page_name = "enapupe"; // defines which pages settings will appear on. Either bespoke or media/discussion/reading etc
var $title = "Detrick"; // page title that is displayed
var $nav_title = "Detrick"; // how page is listed on left-hand Settings panel
var $sections = array(
@enapupe
enapupe / menu.php
Last active December 23, 2015 13:19
<?php
function get_menu_html($items, $root_id = 0) {
$html = array();
foreach ($items as $item)
$children[$item['parent_id']][] = $item;
// loop will be false if the root has no children (i.e., an empty menu!)
$loop = !empty($children[$root_id]);