Skip to content

Instantly share code, notes, and snippets.

@angryobject
angryobject / Sourcing_dot_env_files.md
Last active November 23, 2019 12:49
Sourcing .env files

.evn files are used to hold project-related environment variables. This can be helpful if you want to decouple some configuration details from you application logic and/or hide some sensitive information (you don't normally check in this type of files into you repo). An example of a .evn file could be:

.env
API_KEY=secret
PG='{"user":"angryobject","host":"some.remove.server","database":"testing","password":"strongpa$$word","port":5432}'

And example usage as follows:

@angryobject
angryobject / envr.sh
Last active November 13, 2019 20:24
Runs command with environment variables declared in a .env file
# Runs command with environment variables declared in a .env file
# Usage:
# $ envr some fancy command to run
# or with a custom .env file:
# $ envr .my.env some fancy command to run
if [[ "$1" =~ ^.*\.env$ ]]; then
ENV_FILE=$1
CMD=${@:2}
@angryobject
angryobject / .eslintrc
Last active October 21, 2015 10:32
eslint config i'm working on
{
"extends": "eslint:recommended",
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"es6": true
},
@angryobject
angryobject / SVGObjectHelper.js
Created January 13, 2015 08:08
SVGObjectHelper
'use strict';
var SVGObjectHelper = {
replaceAll: function replaceAll(parent, cb) {
parent = parent || document;
var svgObjs = parent.querySelectorAll('object[type="image/svg+xml"]');
var ready = function () {
// --------------------------------------------------------------
// Section
// ============================================================================
// >------------= Block or Module =------------<
// -= Sub block or sub module =-
// * general comment
@angryobject
angryobject / template.php
Last active July 3, 2018 01:00
Drupal 7 menu extra classes
<?php
/**
* This snippet adds extra classes to Drupal
* menu leafs (li tags) and menu itself (ul tags).
*/
/**
* Since the standart preprocess function for menu tree, which is
* template_preprocess_menu_tree, located in includes/menu.inc,
@angryobject
angryobject / .gitignore
Created August 11, 2012 14:24
.gitignore file
# OS generated files #
*.swp
.DS_Store*
Thumbs.db
# Put here whatever you like #
git-ignore/
@angryobject
angryobject / .vimrc
Created August 11, 2012 14:18
.vimrc file
call pathogen#infect()
syntax on
filetype plugin indent on
colorscheme solarized
if has('gui_running')
set background=light
else
@angryobject
angryobject / private.xml
Created August 11, 2012 14:13
KeyRemap4MacBook private.xml (fixes for russian layout on US keyboard)
<?xml version="1.0"?>
<root>
<languagedef>
<name>RUSSIAN</name>
<inputmodeid_equal>org.pqrs.inputmode.ru.Russian</inputmodeid_equal>
</languagedef>
<item>
<name>Slash to dot (Russian only)</name>
<inputmode_only>RUSSIAN</inputmode_only>