Skip to content

Instantly share code, notes, and snippets.

Jacob Mather jmather

View GitHub Profile
@jmather
jmather / Sentry_Exception.cls
Created Aug 8, 2019
Custom Apex Exceptions with stack traces!
View Sentry_Exception.cls
/**
* Created by Jacob Mather <jmather@jmather.com> on 2019-06-25.
*/
global with sharing class Sentry_Exception extends Exception {
global Map<String, Object> context = new Map<String, Object>();
private List<String> stackTrace;
global void setStackTrace(List<String> lines) {
stackTrace = lines;
View jenkins-setup-credentials.groovy
import jenkins.model.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.plugins.credentials.impl.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import hudson.plugins.sshslaves.*;
domain = Domain.global()
store = Jenkins.instance.getExtensionList('com.cloudbees.plugins.credentials.SystemCredentialsProvider')[0].getStore()
View keybase.md

Keybase proof

I hereby claim:

  • I am jmather on github.
  • I am thejmather (https://keybase.io/thejmather) on keybase.
  • I have a public key whose fingerprint is 398D AEDD 8EA9 DC5A 1F2B 4E1B 8494 4ADB 482B B934

To claim this, I am signing this object:

@jmather
jmather / composer.json
Last active Dec 26, 2015
Example composer.json with satis repo and packagist disabled.
View composer.json
{
"repositories": [
{
"type": "composer",
"url": "https://s3.amazonaws.com/my_satis_repo/"
},
{
"packagist": false
}
],
@jmather
jmather / .bashrc
Last active Dec 24, 2015
My work in progress bash profile to make the git repos nicer to work with...
View .bashrc
if tput setaf 1 &> /dev/null; then
tput sgr0
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then
MAGENTA=$(tput setaf 9)
ORANGE=$(tput setaf 172)
GREEN=$(tput setaf 190)
PURPLE=$(tput setaf 141)
WHITE=$(tput setaf 256)
else
MAGENTA=$(tput setaf 5)
@jmather
jmather / MediaServerFilter.php
Created Jan 21, 2013
Media/CDN server w/ Symfony1
View MediaServerFilter.php
<?php
class MediaServerFilter extends sfFilter
{
public function execute($filterChain)
{
$filterChain->execute();
// Execute this filter only once
if ($this->isFirstCall() && sfConfig::get('app_media_filter_disable', false) == false) {
// Filters don't have direct access to the request and user objects.
View LoadWebsiteSpecificData.php
<?php
namespace Demo\Bundle\WebsiteBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Application\Sonata\UserBundle\Entity\User;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
@jmather
jmather / provision.sh
Created Jan 9, 2013
Latest vagrant provision script
View provision.sh
#!/bin/sh
NFSUID=`stat -c %u /vagrant/`
/usr/bin/sudo su -c "cat /etc/passwd | grep -v vagrant:x: > /etc/passwd.new"
/usr/bin/sudo su -c "echo \"vagrant:x:${NFSUID}:502::/home/vagrant:/bin/bash\" >> /etc/passwd.new"
/usr/bin/sudo su -c "chown -R ${NFSUID}:vagrant /home/vagrant"
/usr/bin/sudo su -c "mv -f /etc/passwd.new /etc/passwd"
/usr/bin/sudo su -c "chown -R vagrant:vagrant /var/lib/php/session"
/usr/bin/sudo su -c "chown vagrant:vagrant /tmp/vagrant-*"
@jmather
jmather / .vagrant.init.sh
Last active May 6, 2018
This is in my project's bin/.vagrant.init.sh which is looked for (and ran) by my custom vagrant provision.sh
View .vagrant.init.sh
#!/bin/sh
cp -f app/config/parameters.dist.yml app/config/parameters.yml
rm -rf app/cache/*
php app/console doctrine:database:create
php app/console doctrine:migrations:migrate --no-interaction
yes | php app/console doctrine:fixtures:load
php app/console cache:clear
php app/console assetic:dump
php app/console assets:install --symlink
View MeetingBlock.php
<?php
namespace My\Bundle\BlockBundle\Block;
use Symfony\Component\HttpFoundation\Response;
use Sonata\BlockBundle\Model\BlockInterface;
use Sonata\BlockBundle\Block\BaseBlockService;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Validator\ErrorElement;
You can’t perform that action at this time.