Skip to content

Instantly share code, notes, and snippets.

@snetty
snetty / MyController.php
Created April 13, 2014 16:59
example laravel controller with ajax detection
public static function view($view){
return 'base.' . (Request::ajax() ?: 'ajax.') . $view;
}
public function create()
{
return View::make(self::view('create'), $this->viewVars());
}

Keybase proof

I hereby claim:

  • I am snetty on github.
  • I am snetty (https://keybase.io/snetty) on keybase.
  • I have a public key whose fingerprint is D28B B2A5 BDC5 7341 72EF 02F6 5449 C89C F0AD F6FB

To claim this, I am signing this object:

<?php
class My_Module extends Core_ModuleBase
{
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onExtendCustomerModel', $this, 'extend_customer_model');
}
@snetty
snetty / after.sh
Created October 21, 2015 08:58
Increase max_nesting_level in Laravel Homestead to cater for Pyro CMS (amongst others)
#!/bin/sh
# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
xdebug="xdebug.max_nesting_level=300"
echo "$xdebug" > "/etc/php5/mods-available/xdebug.ini"
@snetty
snetty / helper.php
Created March 3, 2016 12:00
adds git_hash helper for laravel
function http_build_url(array $parsed) {
$get = function ($key) use ($parsed) {
return isset($parsed[$key]) ? $parsed[$key] : null;
};
$pass = $get('pass');
$user = $get('user');
$userinfo = $pass !== null ? "$user:$pass" : $user;
$port = $get('port');
$scheme = $get('scheme');
@snetty
snetty / gist:97938d415c2c722f7f1bba88f9774a15
Created July 27, 2016 11:00 — forked from GreatPotato/gist:5445303
Gets the security details of a LS installation (including encryption key)
<?php
print_r( Phpr_SecurityFramework::create()->get_config_content() );
?>