Skip to content

Instantly share code, notes, and snippets.

View JoshuaEstes's full-sized avatar
👨‍💻

Joshua Estes JoshuaEstes

👨‍💻
View GitHub Profile
<?php
protected function interact(InputInterface $input, OutputInterface $output)
{
$dialog = $this->getDialogHelper();
$validator = Validation::createValidator();
$inputValue = $dialog->ask($output, 'Enter some input: ');
$errors = $validator->validateValue($inputValue, new Assert\NotBlank());
if (count($errors)) {
throw new \RuntimeException('Input cannot be blank');
@JoshuaEstes
JoshuaEstes / gist.php
Last active October 9, 2015 19:17
Symfony2 Validator Component
<?php
namespace Acme\TutorialBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Validator\Validation;
use Symfony\Component\Validator\Constraints as Assert;
class TestCommand extends ContainerAwareCommand
# Add a self generated cert to local keychain so we do not get ssl issues when testing, this is used for development
# and should only be used on your local box
sudo security add-trusted-cert -d -k /Library/Keychains/System.keychain -r trustRoot -p ssl \*.localhost.com.cer

Keybase proof

I hereby claim:

  • I am joshuaestes on github.
  • I am joshuaestes (https://keybase.io/joshuaestes) on keybase.
  • I have a public key whose fingerprint is CFBB C57B 9247 3A67 A039 063B EE48 82DF 7D66 AAB0

To claim this, I am signing this object:

<?php
class BitPayClient
{
private $_client;
private $_network;
private $_adapter;
private $_storageEngine;
public function __construct($setup = false)
@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

@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 / .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 / 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')

Introduction

Purpose

Requirements

Terminology