Skip to content

Instantly share code, notes, and snippets.

View georgestephanis's full-sized avatar

George Stephanis georgestephanis

View GitHub Profile
var d=document,
w=window,
e=w.getSelection,
k=d.getSelection,
x=d.selection,
s=(e?e():(k)?k():(x?x.createRange().text:0)),
l=d.location,
e=encodeURIComponent,
metas=d.head.getElementsByTagName('meta'),
imgs=d.body.getElementsByTagName('img'),
@georgestephanis
georgestephanis / gist:3007101
Created June 27, 2012 21:53
WP trac traceback
Traceback (most recent call last):
File "build/bdist.linux-x86_64/egg/trac/web/api.py", line 436, in send_error
data, 'text/html')
File "build/bdist.linux-x86_64/egg/trac/web/chrome.py", line 868, in render_template
stream.render(method, doctype=doctype, out=buffer)
File "/usr/lib/python2.5/site-packages/Genshi-0.6-py2.5.egg/genshi/core.py", line 183, in render
return encode(generator, method=method, encoding=encoding, out=out)
File "/usr/lib/python2.5/site-packages/Genshi-0.6-py2.5.egg/genshi/output.py", line 58, in encode
for chunk in iterator:
File "/usr/lib/python2.5/site-packages/Genshi-0.6-py2.5.egg/genshi/output.py", line 339, in __call__
@georgestephanis
georgestephanis / storepicker.htm
Created July 9, 2012 17:20
Speck Website Switcher Static Block
<style>
#__store-picker {position:relative; text-align:left;}
#__store-picker img {vertical-align:-2px;}
#__store-picker div.__sp-wrap {visibility:hidden; position:absolute; top:0; right:-24px; z-index:50; width:200px; padding-top:30px; opacity:0;
-webkit-transition: visibility 0s linear 0.2s, opacity 0.2s linear;
-moz-transition: visibility 0s linear 0.2s, opacity 0.2s linear;
-ms-transition: visibility 0s linear 0.2s, opacity 0.2s linear;
-o-transition: visibility 0s linear 0.2s, opacity 0.2s linear;
transition: visibility 0s linear 0.2s, opacity 0.2s linear;
}
@georgestephanis
georgestephanis / gist:3153223
Created July 20, 2012 21:05 — forked from nikibrown/gist:3152904
Add somethign before and after every group of 4 posts...
<?php $tombstones = new WP_Query('category_name=tombstones&posts_per_page=-1'); ?>
<?php $counter = 0; ?>
<?php echo '<div class="slide"><h1>Beginning</h1>'; ?>
<?php if( $tombstones->have_posts() ) : while ( $tombstones->have_posts() ) : ?>
<?php $tombstones->the_post(); $counter++; ?>
<?php if ($counter % 4 == 0) echo '<h1>Ending</h1></div><div class="slide"><h1>Beginning</h1>'; ?>
<?php the_content(); ?>
<?php endwhile; endif;?>
@georgestephanis
georgestephanis / typekit-editor.js
Created July 21, 2012 00:58
Snag the typekit js and pop it in the TinyMCE Editor
links = document.head.getElementsByTagName('link');
tkCss = '';
for(l in links){
li = links[l];
if( li.rel == 'stylesheet' && li.href.match(/use.typekit.com/) )
tkCss = li.href;
}
if( tkCss.length ){
s=document.createElement('link');
s.setAttribute( 'rel', 'stylesheet' );
<?php $tombstones = new WP_Query('category_name=tombstones&posts_per_page=-1&order=ASC'); ?>
<?php $counter = 0; ?>
<div class="slide">
<?php if ( $tombstones->have_posts() ) : while ( $tombstones->have_posts() ) : ?>
<?php if ( $counter && ( $counter % 3 == 0 ) ) echo "</div><!-- /slide -->\r\n\r\n<div class='slide'>"; ?>
<?php $tombstones->the_post(); $counter++; ?>
<?php the_content(); ?>
<?php endwhile; endif;?>
<?php
//Custom Twitter Widget by George
class speck_twitter_widget extends WP_Widget {
public function __construct() {
parent::__construct(
'speck_twitter_widget', // Base ID
'Speck Twitter Widget',
array( 'description' => __( 'A widget to display the most recent tweet from Speck!', 'speck_twitter_widget' ), )
);
[Mon Aug 06 15:56:44 2012] [error] [client 173.13.59.5] PHP Fatal error: Call to a member function getId() on a non-object in /var/www/newsite/app/code/community/OnePica/AvaTax/Model/Avatax/Estimate.php on line 155, referer: http://www.speckproducts.com/bundles/bundle-11.html
[Mon Aug 06 15:56:54 2012] [error] [client 173.13.59.5] PHP Fatal error: Call to a member function getId() on a non-object in /var/www/newsite/app/code/community/OnePica/AvaTax/Model/Avatax/Estimate.php on line 155, referer: http://www.speckproducts.com/bundles/bundle-11.html
[Mon Aug 06 15:57:36 2012] [error] [client 173.13.59.5] PHP Fatal error: Call to a member function getId() on a non-object in /var/www/newsite/app/code/community/OnePica/AvaTax/Model/Avatax/Estimate.php on line 155, referer: http://www.speckproducts.com/bundles/bundle-11.html
[Mon Aug 06 15:57:54 2012] [error] [client 173.13.59.5] PHP Fatal error: Call to a member function getId() on a non-object in /var/www/newsite/app/code/community/OnePica/AvaTax/Model/Avatax
</head>
<?php
$class = '';
if( is_page() ) {
global $post;
/* Get an array of Ancestors and Parents if they exist */
$parents = get_post_ancestors( $post->ID );
/* Get the top Level page->ID count base 1, array base 0 so -1 */
$id = ( $parents ) ? array_pop( $parents ) : $post->ID;
RewriteEngine On
RewriteCond %{HTTP_HOST} ^speckproducts\.com$ [NC]
RewriteRule ^(.*)$ http://www.speckproducts.com/$1 [R=301,L]