Skip to content

Instantly share code, notes, and snippets.

View ChuckJHardy's full-sized avatar

Chuck J Hardy ChuckJHardy

View GitHub Profile
@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
@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:

<?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>

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

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
@ChuckJHardy
ChuckJHardy / MainActivityTest.java
Created March 19, 2014 10:44
Android MainActivityTest Example
package co.uk.myapp.beachroidtest;
import android.app.Fragment;
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase2;
import android.test.TouchUtils;
import android.test.ViewAsserts;
import android.view.View;
public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {
@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
@ChuckJHardy
ChuckJHardy / run.js
Created September 28, 2013 16:19
Express Server for ZeroMQ, Socket.io and Angular.js
'use strict';
var express = require('express'),
app = express(),
http = require('http'),
server = http.createServer(app),
path = require('path'),
io = require('socket.io').listen(server),
fs = require('fs'),
zmq = require('zmq'),
@ChuckJHardy
ChuckJHardy / Gruntfile.js
Last active December 24, 2015 04:19
Gruntfile Express overrides for generator-angular 0.4.0
// Generated on 2013-09-27 using generator-angular 0.4.0
'use strict';
var path = require('path');
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
@ChuckJHardy
ChuckJHardy / Readme.md
Last active March 22, 2025 00:06
ZeroMQ + Node.js + Socket.io + UI for sending message from Ruby to a Javascript UI running on Node.js

Install the following requirements:

brew info zeromq
npm install zmq
npm install socket.io
gem install ffi-rzmq

Within the app directory run the following commands in different panes.

ruby worker.rb