Skip to content

Instantly share code, notes, and snippets.

View brwnx's full-sized avatar
🎯
Focusing

Mikkel Bruun brwnx

🎯
Focusing
View GitHub Profile
public static boolean isDark(Bitmap bitmap){
boolean dark=false;
float darkThreshold = bitmap.getWidth()*bitmap.getHeight()*0.45f;
int darkPixels=0;
int[] pixels = new int[bitmap.getWidth()*bitmap.getHeight()];
bitmap.getPixels(pixels,0,bitmap.getWidth(),0,0,bitmap.getWidth(),bitmap.getHeight());
for(int pixel : pixels){
fixtint(){
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/DMProxy
}
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/DMProxy
#import "HelloWorldAppDelegate.h"
@implementation HelloWorldAppDelegate
@synthesize window;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
NSLog(@"Hello!");
[window makeKeyAndVisible];
}
#import "HelloWorldAppDelegate.h"
@implementation HelloWorldAppDelegate
@synthesize window;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after application launch
[window makeKeyAndVisible];
@brwnx
brwnx / gist:119821
Created May 29, 2009 06:55
Get Array of all NSDates in a given year
- (NSArray *) dates:(int) inYear
{
NSCalendar *calendar = [NSCalendar currentCalendar];
NSMutableArray* result = [[NSMutableArray alloc]init];
NSDate* startDate;
NSDateComponents* comps = [[NSDateComponents alloc] init];
[comps setDay:1];
[comps setMonth:1];
[comps setYear:inYear];
parms= "doaction=patron-login&data=dest%3DXWW%2Fpub%2Fpatronstatus.html+doaction%3D+data%3D+group%3Dpub+tickno%3DLÅNENUMMBER+pin%3PINKODE"
h = Net::HTTP.new("stormp.kk.dk",443)
h.use_ssl = true
res = h.post("/sites/XWW/pub/patronstatus.html",parms).body.gsub("\r","").gsub("\n","")