Skip to content

Instantly share code, notes, and snippets.

@esfourteen-zz
esfourteen-zz / env_migrate
Created August 9, 2017 13:01
if DATABASE_URL is empty set via .env file if present
#!/bin/bash
[ -z "$DATABASE_URL" ] && [ -f .env ] && source .env
echo "DATABASE_URL=$DATABASE_URL"
function errexit() {
local err=$?
set +o xtrace
local code="${1:-1}"
echo "Error in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}. '${BASH_COMMAND}' exited with status $err"
# Print out the stack trace described by $function_stack
if [ ${#FUNCNAME[@]} -gt 2 ]
then
echo "Call tree:"
for ((i=1;i<${#FUNCNAME[@]}-1;i++))
@esfourteen-zz
esfourteen-zz / syntax_highlighting.py
Created December 15, 2011 23:45 — forked from norbajunior/syntax_highlighting.py
Ruby on Rails syntax highlight switcher for Sublime Text 2
import sublime, sublime_plugin
import os
class DetectFileTypeCommand(sublime_plugin.EventListener):
""" Detects current file type if the file's extension isn't conclusive """
""" Modified for Ruby on Rails and Sublime Text 2 """
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """
def on_load(self, view):
filename = view.file_name()