Skip to content

Instantly share code, notes, and snippets.

View jimmybaker's full-sized avatar

Jimmy Baker jimmybaker

View GitHub Profile
{
"meta": { "theme": "elegant" },
"basics": {
"name": "Jimmy Baker",
"label": "Father, Software Developer, Co-founder, CTO",
"picture": "",
"email": "jimmyebaker@gmail.com",
"website": "https://www.linkedin.com/in/jimmybaker/",
"summary": "Jimmy hails from Nashville, TN with a bachelor of science degree from Middle Tenneessee State University. Before starting Cohub, Jimmy worked for many other companies primarily focusing on full-stack web application development. While the majority of his work is focused in the e-commerce realm, Jimmy also helped the team at Salesforce (Desk.com) improve many of their customer service related prodcuts including their Agent, API and business insights offerings.",
"location": {
@jimmybaker
jimmybaker / posts_controller.rb
Created August 16, 2016 17:56
Nested/Top level resource controller sharing
class PostsController < ApplicationController
before_action :find_post, only: [:show, :edit, :update, :destroy]
before_action :find_posts, only: [:index]
def index
end
def show
end
@jimmybaker
jimmybaker / shipping_matrix.rb
Created September 6, 2012 19:10
Dirt simple shipping matrix
class ShippingMatrix
@matrix = {
(1..10) => 2.50,
(11..20) => 5.00,
(21..30) => 10
}
def self.price_for(quantity)
@matrix.find { |range, price| range.include?(quantity) }[1]
@jimmybaker
jimmybaker / gist:2765029
Created May 21, 2012 22:15
some_action.js.erb
{
'html_content': <%= render(:some_partial).inspect %>
}
headers = []
File.open("/path/to/file.tsv") do |file|
file.each_line do |line|
data = line.split(/\t/)
if headers.empty?
headers = data
else
data = Hash[*headers.zip(data).flatten]
MyModel.create(data)
@jimmybaker
jimmybaker / etc_init.d_unicorn_example.co.uk
Created November 3, 2011 20:39 — forked from scottlowe/etc_init.d_unicorn_example.co.uk
Ruby on Rails server setup on Ubuntu 11.04 with Nginx, Unicorn, Rbenv
#! /bin/bash
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn web server
# Description: starts unicorn
@jimmybaker
jimmybaker / gist:1336995
Created November 3, 2011 16:39
jquery form validation
$(document).ready(function(){
$("#id_of_form").validate();
});
production:
partner_id: xxxxxx
sub_partner_id: xxxxxxxx
administrator_secret: xxxxxxxxxxxxxxxxxxxxxxx
user_secret: xxxxxxxxxxxxxxxxxxxxxxx
player_ui_conf: xxxxxxxx
./ext/purelib.rb:2: [BUG] Segmentation fault
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin11.0.0], MBARI 0x6770, Ruby Enterprise Edition 2011.03
make: *** [.rbconfig.time] Abort trap: 6
if @cart.fraudulent?
SalesOrderMailer.send_later(:deliver_fraudulent_notification, @cart, @authorization.params, !@credit_card.verification_value.blank?)
else
save_credit_card(@credit_card) if params[:keep_credit_card_on_file] && ! @using_saved_card
end