Skip to content

Instantly share code, notes, and snippets.

View jlengstorf's full-sized avatar
💭
partyin

Jason Lengstorf jlengstorf

💭
partyin
View GitHub Profile
@jlengstorf
jlengstorf / gist:5819482
Last active December 18, 2015 17:38
How to add a new SFTP user
sudo useradd -d /var/www/vhosts/DOMAIN_NAME -g production -G sftp-only -s /bin/false USER_NAME
@jlengstorf
jlengstorf / README.md
Last active December 18, 2015 05:49
Avoid Huge Processed Logs in Media Temple: Use this updated `logrotate.conf` to avoid the giant logfiles that show up on Media Temple's (dv) servers.

Avoid Huge Logs on a (dv) Server

The default setup of a [(dv) server by Media Temple][1] has logs set up to rotate weekly and without compression. This can result in huge log files that eat server resources and—as I've learned first-hand—kill your server.

Fortunately, this is really easy to work around. All it takes is:

  • Root access to your server
  • (Very) basic knowledge of the command line
@jlengstorf
jlengstorf / README.md
Last active September 10, 2018 01:50
Removes the junk that wpautop adds to shortcodes in WordPress.

Remove Crappy Markup from WordPress Shortcodes

When using shortcodes in WordPress like so:

[shortcode]

Content goes here...

[/shortcode]

jQuery(function($){
$("#instagram").recentInstagramUploads({
access_token: "30794906.1fb234f.8faa8c1dd437479a9ca8f9dda5b202b8",
ig_user_id: "30794906",
photo_count: 16,
photo_class: 'photo'
});
});

"No such file or directory" Error for mysql.sock

When trying to connect to a MySQL database using localhost, some server configurations will throw the following error:

No such file or directory (trying to connect via unix:///var/mysql/mysql.sock)

To correct this error, all that's required is to update the location of mysql.sock in php.ini.

In php.ini, search for the following line and update it with the location of mysql.sock:

<?php
function retrieveEntries($db, $page, $url=NULL)
{
/*
* If an entry ID was supplied, load the associated entry */
var_dump($page);
var_dump($url);
if(isset($url)) {
@jlengstorf
jlengstorf / wordpress-itunes-feed.php
Created March 8, 2013 22:20
Adds iTunes podcasting tags to a WordPress RSS2 feed for post type "podcast"
<?php
/* BEGIN PODCASTING FILTER HOOKS */
function example_add_itunes_namespace( )
{
if (get_post_type()==='podcast') {
echo 'xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"';
}
}
@jlengstorf
jlengstorf / .htaccess
Created February 28, 2013 21:59
Apache configuration for forcing a secure connection to the site.
# Force SSL
RewriteCond %{SERVER_PORT} !443$
RewriteRule ^(.*)$ https://www.example.org/$1 [L]
@jlengstorf
jlengstorf / wp-img-defaults.css
Created February 26, 2013 23:06
Default styling for WordPress image alignment and captions
/*
* Default WP Alignment Classes
*****************************************************************************/
.aligncenter,.alignleft,.alignright {
display: block;
padding: 0;
}
.aligncenter {
@jlengstorf
jlengstorf / gist:4955862
Created February 14, 2013 19:58
Standard ShareThis snippet for use in WordPress loops.
<div class="share-buttons" style="margin-bottom: 1em;">
<span class="st_fblike_hcount" st_url="<?php the_permalink(); ?>" st_title="<?php the_title(); ?>" displayText="Facebook Like"></span>
<span class="st_twitter_hcount" st_url="<?php the_permalink(); ?>" st_title="<?php the_title(); ?>" displayText="Tweet"></span>
<span class="st_sharethis_hcount" st_url="<?php the_permalink(); ?>" st_title="<?php the_title(); ?>" displayText="ShareThis"></span>
</div><!--/.share-buttons-->