Skip to content

Instantly share code, notes, and snippets.

// call when zoom level or page size changes (i.e. after zooming or after rotation)
- (void)updateContentInsetForPageScrollView:(UIScrollView *)pageScrollView {
UIImageView *imageView = (UIImageView *) [pageScrollView viewWithTag:TAG_IMAGE_VIEW];
CGFloat zoomScale = pageScrollView.zoomScale;
CGSize imageSize = imageView.bounds.size;
CGSize zoomedImageSize = CGSizeMake(imageSize.width * zoomScale, imageSize.height * zoomScale);
CGSize pageSize = pageScrollView.bounds.size;
@runeb
runeb / mls.rb
Created April 23, 2011 15:10 — forked from judofyr/mls.rb
Conversions between latitude, longitude and Maidenhead Locator System
module MLS
extend self
GRID = ("A".."R").to_a
SQUARE = ("0".."9").to_a
SUB = ("a".."x").to_a
deg = 180.0
PARTS = [[18, GRID], [10, SQUARE], [24, SUB], [10, SQUARE]]
PARTS.map! { |div, part| [deg = deg / div, part] }
#!/usr/bin/env ruby
# put in /etc/munin/plugins and restart munin-node
# by Dan Manges, http://www.dcmanges.com/blog/rails-application-visualization-with-munin
# NOTE: you might need to add munin to allow passwordless sudo for passenger-memory-stats
def output_config
puts <<-END
graph_category App
graph_title Passenger memory stats
graph_vlabel count