Skip to content

Instantly share code, notes, and snippets.

View JoshuaEstes's full-sized avatar
👨‍💻

Joshua Estes JoshuaEstes

👨‍💻
View GitHub Profile
@JoshuaEstes
JoshuaEstes / form.html.twig
Created June 3, 2013 16:29
Symfony2 Functional Form Tests
<form id="that-one-form">
{{ form_widget(form) }}
</form>
@JoshuaEstes
JoshuaEstes / form.html.twig
Last active December 18, 2015 03:18
form.html.twig
{% set email_class = '' %}
{% if form.email.vars.errors %}
{% set email_class = 'error' %}
{% endif %}
{{ form_label(form.email, 'Email', {'label_attr':{'class':email_class}}) }}
{{ form_widget(form.email, {'attr':{'class':email_class}}) }}
{% if form.email.vars.errors %}
{% for error in form.email.vars.errors %}
<small class="error">{{ error.message }}</small>
@JoshuaEstes
JoshuaEstes / gist:6831131
Created October 4, 2013 19:13
mysql export table into CSV file
mysql -u USERNAME -p DATABASE -e "select * from TABLE;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g'
@JoshuaEstes
JoshuaEstes / 00-README.markdown
Last active August 29, 2015 14:00
My goto files for when I initialize a new symfony2 project. It includes bash scripts, composer.json files and a few other things.

README

These are the default files that I will usually start with when setting up a symfony2 project to use vagrant and puppet. I'm putting this readme file here for future updates.

Usage

Make sure the files that end in .sh are executable.

@JoshuaEstes
JoshuaEstes / pre-commit.phpcs
Last active August 29, 2015 14:03
Various git hooks
#!/bin/sh
###
#
# Runs phpcs to check for violations
#
PHPCS_BIN=$(command -v phpcs)
if [ ! $PHPCS_BIN ]; then
exit 0
fi

Introduction

Purpose

Requirements

Terminology

@JoshuaEstes
JoshuaEstes / heroku_config_set.sh
Last active January 10, 2021 18:04
This is a simple one line command that takes your local .env file and sets all the environmental variables on heroku for you to edit
heroku config:set $(cat .env | tr '\n' ' ' | sed -e 's/export //g')
@JoshuaEstes
JoshuaEstes / .env
Created September 17, 2014 21:00
Basic .env file for working with Symfony2 projects. Just need to comment out the include
export SYMFONY__SECRET=ReplaceWithToken
export SYMFONY__LOCALE=en
export SYMFONY__ASSETIC__CONTROLLER=true
export SYMFONY__DATABASE__DRIVER=pdo_sqlite
export SYMFONY__DATABASE__HOST=127.0.0.1
export SYMFONY__DATABASE__NAME=symfony
export SYMFONY__DATABASE__PASSWORD=root
export SYMFONY__DATABASE__PORT=3667
export SYMFONY__DATABASE__USER=root
export SYMFONY__MAILER__TRANSPORT=smtp
@JoshuaEstes
JoshuaEstes / rpc.bash
Created September 30, 2014 11:36
Using httpie for json-rpc commands to a bitcoind server
http --auth USERNAME:PASSWORD http://127.0.0.1:18332 method=getaccountaddress params:='[""]'
@JoshuaEstes
JoshuaEstes / Vagrant.rst
Last active August 29, 2015 14:08
Useful Oneliners

Vagrant

# Gettting the state of the machine, ie Is it poweroff or running

vagrant status --machine-readable | awk -F',' '$3 == "state" { print $4 }'

Can be used in a script like so