Skip to content

Instantly share code, notes, and snippets.

View pjkelly's full-sized avatar

PJ Kelly pjkelly

  • Orange County, CA
View GitHub Profile
@pjkelly
pjkelly / example.md
Created December 14, 2012 19:34 — forked from anonymous/example.md
Unwrap text in Sublime Text.

Note: This assumes there are no spaces at the end of lines.

Example Text:

Praesent commodo cursus magna, vel scelerisque nisl
consectetur et. Nulla vitae elit libero, a pharetra
augue. Curabitur blandit tempus porttitor. Maecenas
faucibus mollis interdum. Donec ullamcorper nulla
non metus auctor fringilla. Cras mattis consectetur
window.AppName =
Models: {}
Colls: {}
Views: {}
Routers: {}
Data: {}
Pages:
Home:
init: ->
new AppName.Views.HomePage el: $("body")
@pjkelly
pjkelly / install.md
Created August 24, 2012 18:30
Install REE on Mountain Lion with rbenv
  1. Make sure you've install X11 from here: http://xquartz.macosforge.org/landing/.
  2. Set CPPFLAGS environment variable:

$ export CPPFLAGS=-I/opt/X11/include 3. Find gcc-4.2 on your system:

$ which gcc-4.2
=> /Users/pjkelly/Developer/bin/gcc-4.2
@pjkelly
pjkelly / calculate-construction-cost.md
Created March 8, 2012 00:38
Calculating Time and Cost of Building Floors in Tiny Tower

Calculating Construction Cost

According to the Tiny Tower Wiki the equation for calculating how much it costs to build a given floor is:

cost = 150 × floor_number 2

A simple way to evaluate this equation in Ruby would be:

@pjkelly
pjkelly / instructions.md
Created February 27, 2012 07:57
Crush + Lovely Development Environment Setup for Mac OS X Lion

Before you start

These instructions work best on a fresh system. While I've gotten them to work on a system where I just upgraded from Snow Leopard to Lion and had a previously working development environment (using an older version of Cinderella in my case), it was not without difficulty. It's much easier to start from scratch.

These instructions are for Mac OS X 10.7.x (Lion) only.

SSH Keys

If you have SSH keys setup already

@pjkelly
pjkelly / installer.sh
Created August 11, 2011 18:59
Installing PHPUnit via Pear on Ubuntu Lucid
# Uninstall any pre-existing packaged
# versions of phpunit
sudo apt-get remove phpunit
# Install pear via apt-get
sudo apt-get install php-pear
# Update existing pear channels
sudo pear channel-update pear.php.net
@pjkelly
pjkelly / example.rb
Created July 21, 2011 02:16
JSON Encoding in Rails 1.2.x
# In Rails 1.2.x, the default JSON encoder doesn't quote
# attributes. To force quoting, set the following option
# to false. From the ActiveSupport::JSON docs:
#
# When +true+, Hash#to_json will omit quoting string or symbol keys
# if the keys are valid JavaScript identifiers. Note that this is
# technically improper JSON (all object keys must be quoted), so if
# you need strict JSON compliance, set this option to +false+.
# mattr_accessor :unquote_hash_key_identifiers
# @@unquote_hash_key_identifiers = true
@pjkelly
pjkelly / import.rb
Created July 21, 2011 02:16
Converting JSON to Google Spreadsheets
require 'rubygems'
require 'yajl'
require 'to_google_spreadsheet'
json = File.new('sizes.json', 'r') # file with more than one json
parser = Yajl::Parser.new
data = parser.parse(json)
GoogleSpreadsheet.config do |c|
c.email = "[email protected]"
@pjkelly
pjkelly / README.markdown
Created July 7, 2011 17:04
Unattended interactive installers with Puppet/Moonshine

Three options:

  1. If an apt-get package is available, use it, then tweak configuration files after installation.
  2. If no package is available, see if the installer has a "noninteractive" mode. For instance, apt-get can be forced to auto-answer all questions with the defaults using ENV['DEBIAN_FRONTEND'] = "noninteractive".
  3. If a noninteractive mode is not available, try feeding the installer an answer file. e.g.
pecl install apc < answers.txt 
@pjkelly
pjkelly / check-packages-installed.sh
Created July 7, 2011 01:08
What packages are installed via apt-get?
# credit: http://crshlv.ly/pSqu6l
# show all packages installed
dpkg --get-selections
# show all packages installed containing "php"
dpkg --get-selections | grep php