Skip to content

Instantly share code, notes, and snippets.

@pleckey
pleckey / newrelic_app_before.php
Created June 27, 2014 13:29
Transaction naming using App::before
App::before(function($request){
$nameProvider = Config::get('laravel-newrelic::name_provider');
if ( is_callable($nameProvider) ) {
$name = $nameProvider( $request, null, $app );
} else {
$name = Route::currentRouteName()
?: Route::current() && Route::currentRouteAction()
?: $request->getMethod . ' ' . $request->getPathInfo();
}
@pleckey
pleckey / array_closure.php
Created January 1, 2014 21:53
Closures as array values
<?php
$array = array(
'first' => 'test',
'second' => function(){ return 'passed'; },
);
var_dump( $array );
foreach ( $array as $k => $v )
{
@pleckey
pleckey / cleanup.sh
Created July 15, 2013 00:35
Minimize Ubuntu vagrant box size for packaging
#!/bin/bash
##
# Run as sudo, then exit and package immediately
##
# Remove unnecessary packages
aptitude purge ri
aptitude purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude purge python-dbus libnl1 python-smartpm linux-headers-2.6.32-21-generic python-twisted-core libiw30
@pleckey
pleckey / gist:5830962
Created June 21, 2013 12:53
Phing targets to start PHP 5.4 testing server and localtunnel server
<property name="project.displayName" value="MyProject"/>
<property name="project.publicFolder" value="./public"/>
<property name="project.publicPort" value="8000"/>
<!-- ============================================ -->
<!-- Target: Server -->
<!-- ============================================ -->
<target name="server" description="starts a local testing server">
<echo message="Starting ${project.displayName} server in ${project.publicFolder} on port ${project.publicPort}"/>
<exec command="php -S 0.0.0.0:${project.publicPort}" dir="${project.publicFolder}" logoutput="true" passthru="true"/>
@pleckey
pleckey / Vagrantfile
Created March 15, 2013 15:08
chef solo recipe testing on Vagrant
Vagrant::Config.run do |config|
config.vm.box = "precise64"
config.vm.customize [
"modifyvm", :id,
"--name", "chef-#{ENV['USER']}",
"--memory", "1024"
]
config.vm.network :hostonly, "10.0.0.100"
@pleckey
pleckey / git-feature
Last active December 14, 2015 21:29
Git alias to create a feature branch. Modify origin/qa repo as necessary.
git config --global alias.feature '!f(){ git checkout master && git fetch && git pull origin master && git checkout -b ${1} && git push -u origin ${1}; };f'
@pleckey
pleckey / gist:5151744
Created March 13, 2013 12:47
Make a Mac keyboard more responsive
defaults write -g KeyRepeat -integer 2
defaults write -g InitialKeyRepeat -integer 15