Skip to content

Instantly share code, notes, and snippets.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-name.com$
RewriteCond %{REQUEST_URI} !folder/
RewriteRule (.*) /folder/$1 [L]
@tobalsan
tobalsan / wp-custom-widget.php
Last active August 29, 2015 14:04
WordPress: register custom widget
add_action( 'widgets_init', create_function( '', 'register_widget( "My_Widget_Recent_Posts" );' ) );

How to successfully install vendors of Symfony2 on Dreamhost Shared

Sometimes, simply running php composer install or php composer update will throw an error at building bootstrap.php time. To resolve this issue, proceed like this:

First, run:

php composer update --no-scripts
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html> <!--<![endif]-->
<?php
header("Content-type: text/plain");
$json = file_get_contents('php://input');
$data = json_decode($json,true);
$file = __DIR__ . '/../app/logs/git.log';
$date = date('Y-m-d H:i:s');
if(!count($data['commits'])) {

Improve memory usage on AMAZON EC2 Micro instance

Try to Change this setting in mysql configuration file (my.cnf)

key_buffer              = 8M 
max_connections         = 30 // Limit connections
query_cache_size        = 8M // try 4m if not enough 
query_cache_limit = 512K

Full Debian backup procedure

The backup

Create the shell script

Before anything, create the backup dir:

SELECT
p.*,
GROUP_CONCAT(t.tag_name) tagged
FROM
tags_relation tr
INNER JOIN posts p ON p.post_id = tr.rel_post_id
INNER JOIN tags t ON t.tag_id = tr.rel_tag_id
GROUP BY
p.post_id
/*All you have to do is create a div inside the div you want to give an inset border to*/
#something {
background: transparent url(http://davidrhysthomas.co.uk/linked/astrid_avatar.png) 50% 50% no-repeat;
min-width: 300px;
min-height: 300px;
padding: 0;
position: relative;
}
#!/bin/bash
filedir=$1;
echo "Starting converstion to mp4 script"
if [ -d "$filedir" ]; then
cd "$filedir"
for file in ./* ;
do
if [[ $file = *.mkv || $file = *.avi ]] ; then