This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$s3 = Route53Client::factory(array( | |
'credentials' => [ | |
'key' => env('AWS_KEY'), | |
'secret' => env('AWS_SECRET'), | |
], | |
'region' => env('AWS_REGION'), | |
'version' => 'latest', | |
)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$testCases[] = '123'; // Should be 124 | |
$testCases[] = '123=RH'; // Should be 124=RH | |
$testCases[] = '123RH'; // Should be 124RH | |
$testCases[] = '123R4'; // Should be 124R4 | |
$testCases[] = 'RH123'; // Should be RH124 | |
$testCases[] = 'RH-123'; // Should be RH-124 | |
foreach($testCases as $testCase) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Deployer; | |
require 'recipe/laravel.php'; | |
// Configuration | |
set('repository', '-- put Git Repo URL here --'); | |
set('ssh_type', 'native'); | |
set('shared_files', ['.env']); | |
set('shared_dirs', [ | |
'storage/app', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class App | |
{ | |
/** | |
* Application Registry | |
* | |
* @var array | |
*/ | |
protected $registry = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isRequired = () => { throw new Error('param is required'); }; | |
const hello = (name = isRequired()) => { console.log(`hello ${name}`) }; | |
// This will throw an error because no name is provided | |
hello(); | |
// This will also throw an error | |
hello(undefined); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant.configure(2) do |config| | |
config.vm.box = "ubuntu/trusty64" | |
# Don't check for updates. We'll handle this through Ansible | |
config.vm.box_check_update = false | |
config.vm.network :private_network, ip: "192.168.10.10" | |
config.vm.network "forwarded_port", guest: 80, host: 8080 | |
config.vm.network "forwarded_port", guest: 443, host: 8443 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!defined('MYPLUGIN_THEME_DIR')) | |
define('MYPLUGIN_THEME_DIR', ABSPATH . 'wp-content/themes/' . get_template()); | |
if (!defined('MYPLUGIN_PLUGIN_NAME')) | |
define('MYPLUGIN_PLUGIN_NAME', trim(dirname(plugin_basename(__FILE__)), '/')); | |
if (!defined('MYPLUGIN_PLUGIN_DIR')) | |
define('MYPLUGIN_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . MYPLUGIN_PLUGIN_NAME); | |
if (!defined('MYPLUGIN_PLUGIN_URL')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Turns WordPress debugging on | |
define('WP_DEBUG', true); | |
// Tells WordPress to log everything to the /wp-content/debug.log file | |
define('WP_DEBUG_LOG', true); | |
// Doesn't force the PHP 'display_errors' variable to be on | |
define('WP_DEBUG_DISPLAY', false); | |
// Hides errors from being displayed on-screen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function getUserIP() | |
{ | |
$client = @$_SERVER['HTTP_CLIENT_IP']; | |
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; | |
$remote = $_SERVER['REMOTE_ADDR']; | |
if(filter_var($client, FILTER_VALIDATE_IP)) { | |
$ip = $client; | |
} | |
elseif(filter_var($forward, FILTER_VALIDATE_IP)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Route::group(['middleware' => 'auth'], function () { | |
Route::get('{view}', function ($view) { | |
try { | |
return view($view); | |
} catch (\Exception $e) { | |
abort(404); | |
} | |
})->where('view', '.*'); | |
}); |