Skip to content

Instantly share code, notes, and snippets.

View jimmyhillis's full-sized avatar

Jimmy Hillis jimmyhillis

View GitHub Profile
@jimmyhillis
jimmyhillis / Preferences.sublime-settings
Created August 10, 2012 12:15
My stock and useful set of Sublime Text 2 Preferences
{
// Styles, themes, and typography
"bold_folder_labels": true,
"detect_indentation": false,
"ensure_newline_at_eof_on_save": true,
"font_face": "Source Code Pro ExtraLight",
"font_size": 13.0,
"highlight_modified_tabs": true,
// File management
@jimmyhillis
jimmyhillis / _hash.js
Created December 19, 2012 10:33
Simple function to return the #hash_component and nothing else from a URL string which can contain as much or little of a URL in any order.
function _hash(url_string) {
var a = document.createElement('A');
a.href = url_string;
return a.hash.split('?')[0].split('&')[0];
}
@jimmyhillis
jimmyhillis / disqus.jade
Last active December 10, 2015 04:58
Jade markup for integrating Disqus within a template
#disqus_thread
noscript Please enable JavaScript to view the
a(href='http://disqus.com/?ref_noscript') comments powered by Disqus
a(href="http://disqus.com", class="dsq-brlink") comments powered by
span(class="logo-disqus") Disqus
script
var disqus_shortname = 'shortname_here';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
@jimmyhillis
jimmyhillis / image.php
Created January 27, 2013 02:45
Simple stub to use within a Wordpress template for building a full size image page, which will be seen whenever you view the permalink for any images in a Wordpress blog. Add this to your theme with the filename `image.php` to use this for all images. Might also consider using `attachment.php` or `single-attachment.php` depending on your situation.
<article class="article">
<?php $attachment_info = getimagesize($post->guid); ;?>
<div class="content">
<img src="<?php echo $post->guid; ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" <?php echo $attachment_info[3]; ?> />
</div>
<a href="<?php echo get_permalink($post->post_parent); ?>" title="<?php echo get_the_title($post->post_parent); ?>">Back to <?php echo get_the_title($post->post_parent); ?></a>
</article>
@jimmyhillis
jimmyhillis / facebook-tab-height.js
Created February 19, 2013 01:46
Remove the default height restriction from Facebook iFrame tabs with a simple JavaScript callback run as soon as the Facebook SDK is initialized.
window.fbAsyncInit = function() {
FB.init({
appId: '415273505232476',
status: true,
cookie: true,
xfbml: true
});
FB.Canvas.setAutoGrow();
};
// Load the SDK Asynchronously
@jimmyhillis
jimmyhillis / index.html
Created May 17, 2013 08:14
A CodePen by Burak Can. CSS only 3d Macbook Air - No-js :) Just for fun and practice
<div class="macbook">
<div class="inner">
<div class="screen">
<div class="face-one">
<div class="camera"></div>
<div class="display">
<div class="shade"></div>
</div>
<span>MacBook Air</span>
</div>
@jimmyhillis
jimmyhillis / index.html
Created May 17, 2013 08:14
A CodePen by Burak Can. CSS only 3d Macbook Air - No-js :) Just for fun and practice
<div class="macbook">
<div class="inner">
<div class="screen">
<div class="face-one">
<div class="camera"></div>
<div class="display">
<div class="shade"></div>
</div>
<span>MacBook Air</span>
</div>
@jimmyhillis
jimmyhillis / commacommaand.py
Created June 19, 2013 09:04
This function returns a list of items with the comma, comma & format for a list of strings.
def commacommaand(items):
return ', '.join(items)[::-1].replace(',', '& ', 1)[::-1]
@jimmyhillis
jimmyhillis / gist:6034952
Created July 19, 2013 03:41
Indirect allows you to return a list of elements from selectors found within a set of elements from a selector. It's pointers for jQuery, which can be very useful when dealing with filtering and categorizing event actions like showing/hiding relating navigation elements for mobile.
/**
* Indirect returns elements found by the called selector within the
* provided attribute.
*
* > <a href="#" class="show-menu" data-show-navigation=".main-navigation">
* > $('.show-menu').indirect('[data-show-navigation]')
*
* This will return the equivalent of calling $('.main-navigation') which
* allows you to indirectly find a list of elements from a set of
* existing "pointer" elements.
@jimmyhillis
jimmyhillis / gallery-zoom.html
Created August 19, 2013 02:37
Zoom function to increase the size of the image responsively within it's container element at the correct height position.