Skip to content

Instantly share code, notes, and snippets.

View jimmynotjim's full-sized avatar
☀️
Enjoying SoCal "Fall"

Jimmy Wilson jimmynotjim

☀️
Enjoying SoCal "Fall"
View GitHub Profile
@jimmynotjim
jimmynotjim / include-tweets.php
Created April 7, 2012 03:44 — forked from ericrasch/include-tweets.php
How to display your latest tweets in your WordPress site without a plugin
<?php
// How to display your latest tweets in your WordPress site without a plugin
// Source: http://dinolatoga.com/2010/07/31/how-to-display-your-latest-tweets-in-your-wordpress-blog-without-a-plugin/
include_once(ABSPATH . WPINC . '/feed.php');
//configuration
$username = "EricRasch"; // Just insert the username of the Twitter account you want to display
$feed = "http://twitter.com/statuses/user_timeline/$username.rss"; // Changed the code from dinolatoga.com to actually use the username variable
$num = 2; // Set the number of Tweets you want to display
@jimmynotjim
jimmynotjim / first-paragraph-class.php
Created April 7, 2012 03:44 — forked from ericrasch/first-paragraph-class.php
WordPress: Add Class to first Paragraph in WordPress the_content; (add this to the functions.php in your Theme)
<?php
/* =BEGIN: Add Class to first Paragraph in WordPress the_content();
Source: http://webdevbits.com/wordpress/add-class-to-first-paragraph-in-wordpress-the_content/
---------------------------------------------------------------------------------------------------- */
function first_paragraph($content){
// Testing to see if the content is a Page or Custom Post Type of school, if so, display the text normally (without the class = intro).
if ( is_page() || ('school' == get_post_type() ) ) {
return preg_replace('/<p([^>]+)?>/', '<p$1>', $content, 1);
} else {
return preg_replace('/<p([^>]+)?>/', '<p$1 class="intro">', $content, 1);
@jimmynotjim
jimmynotjim / content-kitchen-sink.html
Created April 7, 2012 03:44 — forked from ericrasch/content-kitchen-sink.html
HTML Kitchen Sink (taken from BlueTrip CSS Framework) includes the major (and minor) HTML tags you might use on any given site.
<h1>Level 1 heading</h1>
<p>Sed scelerisque sagittis lorem. Phasellus sodales. Nulla urna justo, vehicula in, suscipit nec, molestie sed, tellus.</p>
<h1 class="fancy">Level 1 heading class="fancy"</h1>
<p>Sed scelerisque sagittis lorem. Phasellus sodales. Nulla urna justo, vehicula in, suscipit nec, molestie sed, tellus.</p>
<h1 class="thin">Level 1 heading class="thin"</h1>
@jimmynotjim
jimmynotjim / fb-comments.html
Created April 25, 2012 17:34
Adaptive sizing for FB comments plugin
<!-- New HTML5 FB Comments -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
@jimmynotjim
jimmynotjim / gist:2570530
Created May 1, 2012 19:04
Add user avatar uploader to admin panel and function call for front end
<?php
/* BEGIN: add user info
---------------------------------------------------------------------------------------------------- */
add_action( 'show_user_profile', 'show_extra_profile_fields' );
add_action( 'edit_user_profile', 'show_extra_profile_fields' );
function show_extra_profile_fields( $user ) { ?>
@jimmynotjim
jimmynotjim / directions
Created May 4, 2012 00:16
Animated Scrolling
Add a class of .scrollPage to any trigger link on the page and script will run when the link is clicked.
@jimmynotjim
jimmynotjim / gist:2663844
Created May 12, 2012 02:54 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@jimmynotjim
jimmynotjim / readme
Created May 23, 2012 01:50
Simple Clean JS script to create Faux Small Caps
I needed to create some faux small caps that were only slightly smaller than the full cap. Font-variant was too drastic so instead I wrapped each word in a <span> set the span to inline-block and used :first-letter to increase the font-size of the first letter in each word.
@jimmynotjim
jimmynotjim / readme
Created May 25, 2012 00:47
jQuery script to equalize the sidebar and content of a page
Simple jQuery script to set a sidebar to always span the height of a page. Required when the sidebar has a background, borders, or shadows. #main is the container for both the sidebar and content and can be replaced w/ any other element. It's important to use min-height, in case your sidebar has moving/changing elements that could resize it larger than the main content (or just happens to be larger than the main content).
@jimmynotjim
jimmynotjim / custom-list.less
Created June 14, 2012 17:03
Custom Ordered List Mixins in LESS
// This is a snipit from a post I wrote up detailing the process. Check it out if you want to learn more
// https://jimmynotjim.snipt.net/create-a-custom-ordered-list-in-css-and-sass/
// Basic mixin to prefix each li w/ it's list number
.custList {
counter-reset: item;
list-style: none;
& > li {
&::before {