Skip to content

Instantly share code, notes, and snippets.

View gr4y's full-sized avatar

Sascha Wessel gr4y

View GitHub Profile
.unread #alert_beacon, .unread_generic { background-color: black; }
mkdir src
cd src
git clone git://github.com/tjfontaine/airprint-generate
cd airprint-generate
./airprint-generate.py
cp *.service /etc/avahi-daemon/services
sudo service avahi-daemon restart
@gr4y
gr4y / error
Created December 23, 2010 11:42
Request from "fe80::cabc::c8ff:fe05:3967%eth1" using invalid Host: field "atlantis.local"
We couldn’t find that file to show.
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:68:in `installed_spec_directories': undefined method `path' for Gem:Module (NoMethodError)
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:58:in `from_installed_gems'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:883:in `source_index'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/gem_path_searcher.rb:81:in `init_gemspecs'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/gem_path_searcher.rb:13:in `initialize'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:841:in `new'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:841:in `block in searcher'
from <internal:prelude>:10:in `synchronize'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:840:in `searcher'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:479:in `find_files'
@gr4y
gr4y / index.php
Created May 23, 2011 15:12
how to get wordpress custom post types into your loop?
<?php query_posts( array( 'post_type' => array( 'g4w_photo', 'post' ) ) );
if (have_posts()) : while(have_posts()) : the_post(); ?>
<?php get_template_part('parts/article'); ?>
<?php endwhile; else: ?>
<?php get_template_part('parts/404'); ?>
<?php endif; ?>
@gr4y
gr4y / boolcrap.php
Created May 24, 2011 21:20
Oh dear... 1 reason out of 30 bazillion reasons why PHP is crap!
var_dump((bool) "false"); // returns bool(true)
function g4w_feed_request($qv) {
if (isset($qv['feed']) && !isset($qv['post_type']) && get_option('g4w_photo_loop') == "true")
$qv['post_type'] = array('post', 'g4w_photo');
return $qv;
}
add_filter('request', 'g4w_feed_request');
@gr4y
gr4y / gist:1004026
Created June 2, 2011 06:39 — forked from bueltge/gist:998648
Example for add a Custom Post Type to the WordPress Loop
// add custom post type to wp loop
add_filter( 'pre_get_posts', array(&$this, 'add_to_query') );
// ads to query
function add_to_query( $query ) {
if ( is_admin() || is_preview() )
return;
//if ( is_home() || is_front_page() && ( false == $query->query_vars['suppress_filters'] ) ) {
@gr4y
gr4y / .htaccess
Created June 13, 2011 08:57
Just in case I can't remember this...
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]