Skip to content

Instantly share code, notes, and snippets.

View SeanJA's full-sized avatar
🦑
🦖

SeanJA SeanJA

🦑
🦖
View GitHub Profile
@SeanJA
SeanJA / time.php
Created November 28, 2012 23:17
put the characters in the right places
<?php
//made up x start positions... obviously, I think they are a pixel offset?
//days
$text = $interval->format('%D');
imagettftext ($image , $font['size'] , $font['angle'] , 10 , $font['y-offset'] , $font['color'] , $font['file'], $text );
//separator
$text = $interval->format(':');
@SeanJA
SeanJA / GIFEncoder.class.php
Last active November 8, 2021 17:39
dynamic animated gif clock
<?php
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Formerly known as:::
:: GIFEncoder Version 2.0 by László Zsidi, http://gifs.hu
::
:: This class is a rewritten 'GifMerge.class.php' version.
::
:: Modification:
@SeanJA
SeanJA / dashboard.erb
Created November 11, 2012 18:30
disqus comment count widget for dashing
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="disqus_comments" data-view="Number" data-title="Comments" data-moreinfo="This Month" style="background-color:#427EB4;"></div>
<i class="icon-comments icon-background"></i>
</li>
@SeanJA
SeanJA / Gemfile
Created November 6, 2012 04:12
pageviews widget for dashing
gem 'garb', :git => 'git://github.com/Sija/garb.git'
hr.✁ {
border-style: dashed;
border-width: 3px 0 0;
height: 2px;
margin-top: 20px;
width: 90%;
}
hr.✁:before {
content: "\2701"; /* snip */
display: block;
@SeanJA
SeanJA / jquery.referrer.js
Created October 5, 2012 19:23 — forked from gavinblair/jquery.referrer.js
Get the referrer with jQuery: A useless bookmarklet
javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.7.2",function($,L){$.fn.referrer%20=%20function()%20{%20%20%20%20return%20$(document).prop("referrer").toString();};alert($().referrer());});
@SeanJA
SeanJA / jquery.referrer.js
Created October 3, 2012 22:44
Get the referrer in jQuery
jQuery.fn.referrer = function() {
return jQuery(document).prop("referrer").toString();
};
//usage:
jQuery().referrer()
@SeanJA
SeanJA / tabs_might_disappear_better_be_sure_they_are_still_there.php
Created October 2, 2012 13:33
I feel like we only needed one if($tabs) here
<?php if ($tabs): print '<div id="tabs-wrapper" class="clear-block">';
endif; ?>
<?php if ($tabs): ?>
<div id="drupal-control-bar">
<?php endif; ?>
<?php if ($tabs): print '<ul>' . $tabs . '</ul>';
endif; ?>
<?php if ($tabs2): print '<ul class="tabs secondary">' . $tabs2 . '</ul>';
endif; ?>
@SeanJA
SeanJA / sunburst.sass
Created September 21, 2012 14:50
Sunburst mixin for sass
@mixin sunburst($color) {
$color2: darken($color, 15%);
background: -webkit-gradient(linear, 90deg, 90deg, color-stop(50%, transparent), color-stop(50%, $color2), color-stop(100%, $color2)),
-webkit-gradient(linear, 82deg, 82deg, color-stop(50%, transparent), color-stop(50%, $color), color-stop(100%, $color)),
-webkit-gradient(linear, 67deg, 67deg, color-stop(50%, transparent), color-stop(50%, $color2), color-stop(100%, $color2)),
-webkit-gradient(linear, 52deg, 52deg, color-stop(50%, transparent), color-stop(50%, $color), color-stop(100%, $color)),
-webkit-gradient(linear, 37deg, 37deg, color-stop(50%, transparent), color-stop(50%, $color2), color-stop(100%, $color2)),
-webkit-gradient(linear, 22deg, 22deg, color-stop(50%, transparent), color-stop(50%, $color), color-stop(100%, $color)),
-webkit-gradient(linear, 7deg, 7deg, color-stop(50%, transparent), color-stop(50%, $color2), color-stop(100%, $color2)),
-
@SeanJA
SeanJA / better.php
Created August 7, 2012 14:38
I heard you like switches
<?php
function my_module_nodeapi(&$node, $op, $teaser, $page){
$func = 'my_module_nodeapi_'.$node->type.'_'.$op;
if(function_exists($func)){
$func(&$node, $teaser, $page);
}
}