This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Returns a copy of the image that has been transformed using the given affine transform and scaled to the new size | |
// The new image's orientation will be UIImageOrientationUp, regardless of the current image's orientation | |
// If the new size is not integral, it will be rounded up | |
- (UIImage *)resizedImage:(CGSize)newSize | |
transform:(CGAffineTransform)transform | |
drawTransposed:(BOOL)transpose | |
interpolationQuality:(CGInterpolationQuality)quality { | |
// COTTON - adding in scaling for iPhone 4 | |
BOOL shouldScale = NO; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example class by christophercotton to show how to validate JSON in | |
# ActiveRecord | |
class Stuff < ActiveRecord::Base | |
validates_presence_of :my_field | |
validate :valid_json | |
# make sure the JSON is valid | |
def valid_json | |
begin |
NewerOlder