Skip to content

Instantly share code, notes, and snippets.

View stevestreza's full-sized avatar

Steve Streza stevestreza

View GitHub Profile
+(UIImage *)thumbnailForImage:(UIImage *)image withSize:(CGSize)size{
CGImageRef sourceImage = [image CGImage];
const char *byteData = malloc(CGImageGetBytesPerRow(sourceImage) * 75);
if(malloc == NULL) return nil;
CGBitmapInfo info = CGImageGetBitmapInfo(sourceImage);
CGContextRef context = CGBitmapContextCreate(byteData, 75, 75,CGImageGetBitsPerComponent(sourceImage), CGImageGetBytesPerRow(sourceImage), CGImageGetColorSpace(sourceImage), info);
CGContextDrawImage(context, CGRectMake(0,0,size.width, size.height), sourceImage);
CGImageRef destImage = CGBitmapContextCreateImage(context);
--- server.orig.js 2009-01-07 22:07:48.000000000 -0500
+++ server.js 2009-01-07 22:08:56.000000000 -0500
@@ -103 +103 @@ Twitter.serverController = SC.Object.cre
- if (json && json.parseJSON) json = json.parseJSON() ;
+ if (json && SC.json) json = SC.json.decode(json) ;
numberToList :: Integer -> [Integer]
numberToList x
| x == 0 = []
| x < 10 = [x]
| otherwise = (numberToList left) ++ (numberToList right)
where left = x `div` 10
right = x `mod` 10
@stevestreza
stevestreza / gist:55131
Created January 30, 2009 16:39
Create a Fluid app for *twitter.com/* and add this user style
div#container, table#timeline, td.status-body > div{
width: 100% !important;
}
div.wrapper{
padding-left: 0px !important;
padding-right: 0px !important;
}
tr.status > td{
@stevestreza
stevestreza / gist:60911
Created February 9, 2009 18:51
A little bit of JavaScript typing silliness.
var myValue = Number.NaN;
console.log("Is NAN: " + isNaN(myValue)); // returns "Is NAN: true"
console.log("Type: " + typeof myValue); // returns "Type: number"
#import <Cocoa/Cocoa.h>
@interface SSKVOFix : NSObject {
NSMutableDictionary *kvo;
}
@end
25d24
> -(void)setSuspended:(BOOL)suspended;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.stevestreza.iTunesBackup</string>
<key>Nice</key>
<integer>12</integer>
<key>OnDemand</key>
<true/>
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
NSDictionary *immutable = [[NSDictionary alloc] init];
NSMutableDictionary *mutable = [[NSMutableDictionary alloc] init];
NSLog(@"Classnames: %@ and %@",[immutable className], [mutable className]);
<!-- your HTML -->
<div id="galleryContainer">
<ul class="galleria" id="gallery1">
your content here
</ul>
<ul class="galleria" id="gallery2">
your content here
</ul>
<ul class="galleria" id="gallery3">
your content here