Skip to content

Instantly share code, notes, and snippets.

{
"require": {
"wordpress/core": "3.5.2",
"wordpress/twentytwelve": "1.1",
"wordpress/akismet": "2.5.7",
"wordpress/google-sitemap-generator": "3.2.9",
"wordpress/google-analytics-for-wordpress": "4.3.3",
"wordpress/wordpress-importer": "0.6.1"
},
"repositories": [
@ahuggins
ahuggins / moviemode.js
Last active August 29, 2015 14:22
Add Movie Mode to PHP Roundtable
$('.episode-list > div.col-sm-5').attr('id', 'episode-notes').addClass('col-sm-12');
$('.episode-list > div.col-sm-7').attr('id', 'episode-video').addClass('col-sm-12');
$('.episode-list > div').css({transition: 'width 1s'});
$('#episode-video').append('<p style="text-align: center;margin-top: 10px;"><a href="#" id="movie-mode"><i class="fa fa-film"></i> Movie Mode</a></p>');
$('#movie-mode').click( function() {
$('#episode-notes').toggleClass('col-sm-5');
$('#episode-video').toggleClass('col-sm-7');
});
// Something like this:
array_push($profile['items_missing'], array( 'message' => 'Like or save at least 1 hotel', 'action' => 'hotels'));
// could be this:
array_push(
$profile['items_missing'],
[
'message' => 'Like or save at least 1 hotel',
'action' => 'hotels'
]
<?php
// Taken from Illuminate\Support\helpers.php
if (! function_exists('dd')) {
/**
* Dump the passed variables and end the script.
*
* @param mixed
* @return void
@ahuggins
ahuggins / php
Created September 3, 2016 19:07
<?php
public function get($topic, $specific = null, $param = null)
{
if (isset($this->config[$topic])) {
$value = $this->config[$topic];
}
if (! is_null($specific) && isset($value[$specific])) {
$value = $value[$specific];
@ahuggins
ahuggins / gist:5784bca19c25bbc7430aedbb5785b962
Last active November 28, 2016 19:09
die and dump rewrite
<?php
function dump()
{
array_map('pre', func_get_args());
}
function pre($to_dump)
{
echo "<pre>";
// look in .env file for definitions
define("HOST", env('DB_HOST')); // The host you want to connect to.
define("USER", env('DB_USER')); // The database username.
define("PASSWORD", env('DB_PASSWORD')); // The database password.
define("DATABASE", env('DB_DATABASE')); // The database name.
define("SECURE", env('DB_SECURE')); // The database name.
define('FTPHOST', env('SFTP_HOST'));
define('FTPPORT', env('SFTP_PORT'));
define('FTPUSER', env('SFTP_USER'));
<?php
namespace Something {
const example = 'test';
}
namespace Another {
const example = 'anothervalue';
}
<?php
// Before
public function getIDsForClient()
{
$sql = "SELECT DISTINCT FilingID FROM Snapshot1094C WHERE ClientID = ?";
$params = [$this->clientID];
$stmt = sqlsrv_query($this->mssqli, $sql, $params);
$ids = [];
@ahuggins
ahuggins / AppServiceProvider.php
Created February 26, 2017 03:07
Voyager + Laravel 5.4
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**