Skip to content

Instantly share code, notes, and snippets.

@djbriane
djbriane / GeneratePhotoThumbnail.m
Created August 3, 2009 19:43
Method that Creates a Thumbnail from a UIImage
+ (UIImage *)generatePhotoThumbnail:(UIImage *)image {
// Create a thumbnail version of the image for the event object.
CGSize size = image.size;
CGSize croppedSize;
CGFloat ratio = 64.0;
CGFloat offsetX = 0.0;
CGFloat offsetY = 0.0;
// check the size of the image, we want to make it
// a square with sides the size of the smallest dimension
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)selectedImage
editingInfo:(NSDictionary *)editingInfo {
// Save the image to the users album
if (picker.sourceType = UIImagePickerControllerSourceTypeCamera) {
UIImageWriteToSavedPhotosAlbum(selectedImage, nil, nil, nil);
}
@djbriane
djbriane / gist:1951915
Created March 1, 2012 18:22
Ajax Logging Example
function authAjax() {
var params = $("#loginForm").serialize();
$.post("/api/j_spring_security_check", params,
function(data) {
console.log('data loaded:');
console.log(data);
});
}
@djbriane
djbriane / router-dupe_tests.js
Created November 2, 2012 04:22
Backbone.js - Tests for Route with Trailing Spaces
test("#XXXX Trailing spaces (pushState:false).", 1, function() {
var count = 0;
Backbone.history.stop();
// restart History with pushState:false
Backbone.history.start({
pushState: false
});