Skip to content

Instantly share code, notes, and snippets.

View JoelBeasley's full-sized avatar

Joel Beasley JoelBeasley

View GitHub Profile
Go to gmail settings
Scroll down to Signature
Click Insert Image
Url: http://bigleaguepolitics.com/wp-content/uploads/2017/01/email_signature.png
If you are on another email system, use this in your HTML email signature.
<img src="http://bigleaguepolitics.com/wp-content/uploads/2017/01/email_signature.png">
@JoelBeasley
JoelBeasley / financial_update_service.rb
Created February 28, 2015 21:20
Financial Update Service
class FinancialUpdateService
def initialize(stock)
@stock = stock
end
def run
set_last_updated_on
fetch_latest_financial_data
remove_duplicate_data
store_latest_financial_data
@JoelBeasley
JoelBeasley / After.rb
Last active August 29, 2015 14:13
Refactoring Method after watching a Ben Orenstein OO talk.
def calc_earnings_change_history(number_of_years)
earnings_history = Array.new
number_of_months(number_of_years).each_with_index do |month_as_integer, index|
this_month = month_as_integer.months.ago.end_of_month
next_month = this_month.next_month
last_month = this_month.prev_month
percent_change = index == 0 ? 0.0 : percent_change_between_months(share_price_on(last_month), share_price_on(this_month))
<?php
remove_action( 'woo_nav_inside', 'woo_add_nav_cart_link' );
add_filter( 'wp_nav_menu_items', 'woo_move_cart_to_top_nav', 10, 2 );
function woo_move_cart_to_top_nav( $items, $args ) {
global $woocommerce;
if ( $args->menu_id == 'top-nav' ) {
$items .= '<li><a class="cart-contents" href="'.esc_url( $woocommerce->cart->get_cart_url() ).'" title="'.esc_attr_e( 'View your shopping cart', 'woothemes' ).'">'.sprintf( _n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes' ), $woocommerce->cart->cart_contents_count ).' - '.$woocommerce->cart->get_cart_total().'</a></li>';
}
return $items;