Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ChuckJHardy's full-sized avatar

Chuck J Hardy ChuckJHardy

View GitHub Profile
@ChuckJHardy
ChuckJHardy / car_decorator.rb
Created February 17, 2014 17:16
Using SimpleDelegator for Decorators
require 'delegate'
class CarDecorator < SimpleDelegator
def self.decorate(objects)
objects.map { |object| new(object) }
end
def car
__getobj__
end

RSpec Stats

2.1.2

168.967965859 + 180.168413372 + 204.073469793 + 202.330561802 + 213.464530603
969.004941429 Seconds / 16.1501 minutes

2.1.1

197.845757202 + 195.413866426 + 235.140259255 + 206.174857892 + 231.315514325
1065.8902551 Seconds / 17.7648 minutes

Fixing the Load Times

I noticed the boot time for the application was very slow. Here are the actions and steps I took to decrease it.

Benchmark Requires

The first think I needed to do was benchmark how long each bit of code took to be required by the application. I used a script I found on Google to help.

Combining and adding all the require times together you can see that it take almost a minute to load everything.

$ ruby AddTimes_0.rb

<?xml version="1.0"?>
<root>
<item>
<name>Map Function keys to match Apple</name>
<identifier>private.itunes_fkeys</identifier>
<autogen>__KeyToConsumer__ KeyCode::F1, ConsumerKeyCode::BRIGHTNESS_DOWN</autogen>
<autogen>__KeyToConsumer__ KeyCode::F2, ConsumerKeyCode::BRIGHTNESS_UP</autogen>
<autogen>__KeyToKey__ KeyCode::F3, KeyCode::EXPOSE_ALL</autogen>
<autogen>__KeyToKey__ KeyCode::F4, KeyCode::LAUNCHPAD</autogen>
<autogen>__KeyToConsumer__ KeyCode::F5, ConsumerKeyCode::KEYBOARDLIGHT_LOW</autogen>
@ChuckJHardy
ChuckJHardy / keybase.md
Created August 15, 2014 12:41
keybase.md

Keybase proof

I hereby claim:

  • I am ChuckJHardy on github.
  • I am chuckjhardy (https://keybase.io/chuckjhardy) on keybase.
  • I have a public key whose fingerprint is E844 1C85 614A F72D BCAF DCCF 1C0C 9E38 A5B4 C37C

To claim this, I am signing this object:

@ChuckJHardy
ChuckJHardy / Hackintosh.md
Last active August 29, 2015 14:07
My Future Hackintosh Build Project

Processor - £302.57 (Prime)

  1. Intel Core i7 4820K Extreme Quad Core CPU Retail (Socket 2011, 3.70GHz, 10MB, 130W, Unlocked and Unleashed, Hyper-Threading Technology) Amazon £225.00
  2. Intel Core i7 4930K Extreme Hex Core CPU Retail (Socket 2011, 3.40GHz, 12MB, 130W, Hyper-Threading Technology, Virtualisation for Directed I/O) Amazon, CPUBoss £420.88
  3. (Current) Intel i7-5820K Extreme Hex Core CPU Processor (3.30GHz, 15MB Cache, 140W, Socket 2011-V3, 28 Lanes PCI Express Generation 3) Amazon [CPUBoss](http://cpuboss.com/cpus/Intel-Core-i7
def view_css
path = "views/#{params[:controller]}/#{params[:action]}"
stylesheet_link_tag(path) unless Rails.application.assets.find_asset(path).nil?
end
@ChuckJHardy
ChuckJHardy / cnc-widget-example-client-app.html
Last active August 29, 2015 14:14
CnC Widget Example Client Application
<!doctype html>
<head>
<!-- CnC Widget Base Styles Include -->
<link href='https://bucket.s3.amazonaws.com/cf23df2207d99a74fbe169e3eba035e633b65d94.min.css' rel='stylesheet' type='text/css'>
</head>
<body>
<!-- CnC Widget Base Element -->
<div id="click-and-collect-reservation-widget"
data-client="cf23df2207d99a74fbe169e3eba035e633b65d94"

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value