Skip to content

Instantly share code, notes, and snippets.

@jcamachott
jcamachott / new_gist_file
Created May 16, 2013 01:33
Sub query counts
// table called categories, with an id and a parent_category_id
// useful for counting number of subcategories per parent category
SELECT *,
(SELECT count(*) FROM categories c1 where c1.id=categories.parent_category_id)
as TheCount FROM `categories`
@jcamachott
jcamachott / .htaccess
Last active December 15, 2015 08:19
htaccess redirect entire site to one file
RewriteEngine On
RewriteCond %{REQUEST_URI} !=/unavailable.html
RewriteRule ^ /unavailable.html [R=301]