Skip to content

Instantly share code, notes, and snippets.

@yaph
yaph / Generic .htaccess redirect from www to non-www
Created August 6, 2010 09:08
Generic .htaccess redirect from www to non-www
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>
@yaph
yaph / jQueryfy Bookmarklet
Created May 14, 2010 14:10
jQueryfy Bookmarklet
javascript:var%20s=document.createElement('script');s.setAttribute('src',%20'http://code.jquery.com/jquery-latest.js');document.getElementsByTagName('body')[0].appendChild(s);alert('thank%20you%20for%20using%20jquery!');void(s);
@yaph
yaph / gist:134894
Created June 23, 2009 22:33
create a query string from a dictionary (pquery) as returned from cgi.parse_qs / urlparse.parse_qs when urllib.urlencode is not appropriate
# create a query string from a dictionary (pquery) as returned from
# cgi.parse_qs / urlparse.parse_qs when urllib.urlencode is not appropriate
query_string = '&'.join(
'='.join([key, pquery[key][0]]) for key in pquery
)