Skip to content

Instantly share code, notes, and snippets.


Ben Johnson benjohnson77

View GitHub Profile
benjohnson77 /
Created Jun 2, 2017 — forked from slickplaid/
Rackspace Ubuntu Server - Allow older system to get updates using apt with Rackspace's Mirrors
sudo sed -i -e 's/\|\|' /etc/apt/sources.list
View gist:3d2ccd84fb2073985f08
<div class="ls-nav">
<?php if($this->session->userdata('user_type_id') == 1 && $this->session->userdata('is_admin') != 1) { ?>
<li><a href="<?=base_url()?>dashboard" <?=($this->uri->segment(1) == 'dashboard'?'class="active"':NULL)?>><span class="icon-dashboard"></span>Dashboard</a></li>
<li><a href="<?=base_url()?>mail" <?=($this->uri->segment(1) == 'mail'?'class="active"':NULL)?>><span class="icon-mail"></span>Mail</a></li>
<li><a href="<?=base_url()?>client" <?=($this->uri->segment(1) == 'client'?'class="active"':NULL)?>><span class="icon-client"></span>Clients</a></li>
<li><a href="<?=base_url()?>company" <?=($this->uri->segment(1) == 'company'?'class="active"':NULL)?>><span class="icon-company"></span>Companies</a></li>
<li><a href="<?=base_url()?>user" <?=($this->uri->segment(1) == 'user'?'class="active"':NULL)?>><span class="icon-user"></span>Users</a></li>
<li><a href="<?=base_url()?>agent" <?=($this->uri->segment(1) == 'agent'?'class="active"':N
View gist:e8b6d877446e395caa29
describe 'product' do
before(:each) do
visit '/login'
fill_in 'user_name', :with => 'admin'
fill_in 'password', :with => 'Legalinc2015'
click_on 'Sign in'
click_on 'Products'
describe 'stats' do
View gist:8a4f8159cbc19b8e9c83
expect(page).to have_select("input[name='client_status_id']", selected: 'All')
expect(page).to have_select("input[name='client_type_id']", selected: 'All')
expect(page).to have_select("input[name='distributor_id']', selected: 'All')
expect(page).to have_select('input[name='state']', selected: 'All')
expect(page).to have_field('client_name', with: '')
expect(page).to have_field('client_email', with: '')
expect(page).to have_field('client_phone', with: '')
View gist:0ea8cce722c5a41fba42
function alcGetUrlWithProtocol(url)
var useSSL = 'https:' == document.location.protocol;
if (useSSL == true){
var new_url = url.replace(/http:/,'https:');
var new_url = url ;
benjohnson77 / gist:5385f119efff85894247
Created Jul 23, 2014
refactor of the process_items vs process file
View gist:5385f119efff85894247
def self.process_file(uploaded_file)
items = []
CSV.foreach(uploaded_file, headers: false) do |row|
def self.process_items(items)
clearancing_status = create_clearancing_status
benjohnson77 / gist:8695801
Last active Aug 29, 2015
Quick script for mashing up pipedrive and contacturally
View gist:8695801
namespace :pipedrive do
desc "Look into match up pipedrive with contactually"
require 'httparty'
require 'json'
task :import => :environment do
require 'csv'
filename = Rails.root + "lib/tasks/meetingplanners.csv"
benjohnson77 / gist:7108171
Last active Dec 26, 2015
Comparing application performance on Rackspace vs Google Compute Engine
View gist:7108171
Started GET "/books" for at 2013-10-22 20:18:56 +0000
Processing by Web::BooksController#index as HTML
User Load (2.7ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 38 LIMIT 1
(2.4ms) SELECT COUNT(*) FROM `reading_actions` WHERE `reading_actions`.`user_id` = 38 AND `reading_actions`.`action_type` = 'have_read'
(75.2ms) SELECT COUNT(*) FROM `reading_actions` WHERE `reading_actions`.`user_id` = 38 AND `reading_actions`.`action_type` = 'want_to_read'
(54.7ms) SELECT COUNT(*) FROM `reading_actions` LEFT OUTER JOIN readings ON readings.reading_action_id = WHERE `reading_actions`.`user_id` = 38 AND (reading_actions.readable_type in ('Book', 'SocialBook') AND reading_actions.action_type = 'reading_now') AND (CASE WHEN readings.is_private = 1 THEN readings.user_id = 38 ELSE 1 = 1 END)
Rendered shared/v2/_breadcrumb.haml (2.3ms)
(2.8ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM `reading_actions` LEFT OUTER JOIN readings ON readings.readin
benjohnson77 / gist:7107825
Last active Dec 26, 2015
SQL benchmark on 3 different cloud platforms.
View gist:7107825
I decided to add RDS environment to my testing. So I can compare AWS(RDS) to rackspace(Rack DB) to GCE (cloud-SQL) and this is what I find running the same benchmark on all three. GCE is in the same zone, and for comparison AWS server is also in the same zone as RDS.
benchmark I am using is perl test-wisconsin from sql bench
Wisconsin benchmark test
Time for create_table (3): 1 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting data
Time to insert (31000): 317 wallclock secs ( 1.95 usr 2.09 sys + 0.00 cusr 0.00 csys = 4.04 CPU)
Time to delete_big (1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
benjohnson77 / gist:6873279
Last active Dec 24, 2015
Looks like google knife needed some additional OHAI plugin to produce the same data as the AWS-knife command.
View gist:6873279
➜ crockpot git:(master) ✗>knife bootstrap ---- ommitted -----
Bootstrapping Chef on Starting Chef Client, version 11.6.0 resolving cookbooks for run list: ["ohai", "sudo", "users::sysadmins", "apt", "git", "snap", "locales", "imagemagick", "logrotate", "rvm::user", "mysql", "bookshout_passenger", "bookshout_passenger::qa", "instramentalapp_agent"] Synchronizing Cookbooks: - instramentalapp_agent - bookshout_passenger - openssl - build-essential - mysql