Skip to content

Instantly share code, notes, and snippets.

View jmather's full-sized avatar

Jacob Mather jmather

View GitHub Profile
@jmather
jmather / Sentry_Exception.cls
Created August 8, 2019 23:37
Custom Apex Exceptions with stack traces!
/**
* 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;
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()

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 December 26, 2015 01:39
Example composer.json with satis repo and packagist disabled.
{
"repositories": [
{
"type": "composer",
"url": "https://s3.amazonaws.com/my_satis_repo/"
},
{
"packagist": false
}
],
@jmather
jmather / .bashrc
Last active December 24, 2015 01:19
My work in progress bash profile to make the git repos nicer to work with...
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 January 21, 2013 19:21
Media/CDN server w/ Symfony1
<?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.
@jmather
jmather / LoadWebsiteSpecificData.php
Created January 19, 2013 04:53
Load in file assets
<?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 January 9, 2013 21:38
Latest vagrant provision script
#!/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 12:54
This is in my project's bin/.vagrant.init.sh which is looked for (and ran) by my custom vagrant provision.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
<?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;