Skip to content

Instantly share code, notes, and snippets.

View tbleckert's full-sized avatar
💭
I may be slow to respond.

Tobias Bleckert tbleckert

💭
I may be slow to respond.
View GitHub Profile
@tbleckert
tbleckert / EloquentPostRepository.php
Created January 26, 2017 10:56
Repository pattern with Eloquent
<?php
namespace App\Repositories\Post;
use App\Post;
class EloquentPostRepository implements PostRepositoryInterface
{
protected $model;
@tbleckert
tbleckert / wp-db-optimize.php
Created April 9, 2013 09:35
Put this script in your wp-config.php to prevent Wordpress from filling up your database with revisions. A super simple way to optimize the performance of your Wordpress installation.
/* Revisions, behave yourselves */
define('AUTOSAVE_INTERVAL', 120 ); // Default value is 60 seconds.
define('WP_POST_REVISIONS', 3); // Number of revisions to save.
@tbleckert
tbleckert / spotify-embed.css
Created December 8, 2012 00:21
Wordpress Spotify Embed
/* Store in your theme under admin/assets/css or update spotify-embed.php */
.spotify-embed-track {
width: 100%;
margin: auto;
}
.spotify-embed-track label > span {
display: block;
float: left;
<!--[if gte IE 9]>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<![endif]-->
<!--[if lt IE 9]>
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1" />
<![endif]-->
function print_r(arr) {
if( arr.constructor == Array || arr.constructor == Object ) {
document.write('<ul>');
for( var p in arr ) {
if( arr[p].constructor == Array || arr[p].constructor == Object ) {
document.write('<li>['+p+'] => '+typeof(arr)+'</li>');
document.write('<ul>');
print_r(arr[p]);
str.replace(/<\/?[^>]+>/gi, '')
$('a').each(function(){
var url = $(this).attr('href');
var element = $(this);
$.getJSON("http://json-tinyurl.appspot.com/?&callback=?", {url: url}, function(data){
$(element).attr('href', data.tinyurl);
});
});