Skip to content

Instantly share code, notes, and snippets.

View Dimillian's full-sized avatar
📱
SwiftUI EVERYWHERE

Thomas Ricouard Dimillian

📱
SwiftUI EVERYWHERE
View GitHub Profile
@Dimillian
Dimillian / gist:1499021
Created December 19, 2011 21:42
getMenu
-(NSMenu *)getMenu
{
NSMenu *menu = [[NSMenu alloc]initWithTitle:@"Smart Bar App Menu"];
NSMenuItem *firstItem = [[NSMenuItem alloc]init];
[firstItem setTitle:@"Close Web App"];
[firstItem setTarget:self];
[firstItem setAction:@selector(sendCloseDelegate:)];
[firstItem setEnabled:YES];
[menu addItem:firstItem];
[firstItem release];
@Dimillian
Dimillian / gist:1574706
Created January 7, 2012 13:05
Drag and drop, first working attempt
-(void)moveToLocation:(NSPoint)location withInitialMousePosition:(NSPoint)position
{
isDragging = YES;
windowContentView = [[self window]contentView];
if (isDragging) {
//down
if (previousMousePosition.y > location.y) {
float current = position.y - location.y;
swapForce = round(current/drop_height);
if (swapForce != 0 && swapForce != previousSwapForce) {
@Dimillian
Dimillian / gist:1780152
Created February 9, 2012 14:00
Rating stars view
- (void)drawRect:(CGRect)rect
{
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 13, 100, 20)];
[label setFont:[UIFont fontWithName:@"Neutraface Condensed" size:18]];
[label setTextColor:[UIColor colorWithRed:96.0/255.0 green:40.0/255.0 blue:33.0/255.0 alpha:1.0]];
[label setText:@"YOUR RATING"];
[label setBackgroundColor:[UIColor clearColor]];
[self addSubview:label];
@Dimillian
Dimillian / gist:1816017
Created February 13, 2012 10:55
Quick parser
//
// MSJSonParser.m
// MySeeen
//
// Created by Thomas Ricouard on 11/02/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "MSJSonParser.h"
@Dimillian
Dimillian / gist:1918895
Created February 26, 2012 20:42
MSMovie
-(id)initWithResultSeachMovieDic:(NSDictionary *)dic
{
self = [super init];
if (self) {
_title = [dic objectForKey:@"name"];
if ([self isNotNull:[dic objectForKey:@"alternative_name"]]) {
_alternateTitle = [dic objectForKey:@"alternative_name"];
}
else{
_alternateTitle = NSLocalizedString(@"No alternative title", @"No alternatie title movie object");
@Dimillian
Dimillian / gist:1923991
Created February 27, 2012 14:03
MSmovie
-(id)initWithMovieDic:(NSDictionary *)dic fromSearchResult:(BOOL)search
{
self = [super init];
if (self) {
_udid = [dic objectForKey:@"id"];
_title = [dic objectForKey:@"name"];
if ([self isNotNull:[dic objectForKey:@"alternative_name"]]) {
_alternateTitle = [dic objectForKey:@"alternative_name"];
}
else{
@Dimillian
Dimillian / gist:1939449
Created February 29, 2012 09:34
RestRequst
#import <Foundation/Foundation.h>
#import "MSJSonError.h"
@protocol MSRESTRequestDelegate;
@interface MSRESTRequest : NSObject
{
id<MSRESTRequestDelegate>__unsafe_unretained delegetae;
}
@property (nonatomic, unsafe_unretained) id<MSRESTRequestDelegate> delegate;
-(id)initWithMethod:(NSString *)method parameters:(NSArray *)array shouldEscapeParameters:(BOOL)escape;
@Dimillian
Dimillian / gist:1939822
Created February 29, 2012 10:40
MSRESTRequest
@protocol MSRESTRequestDelegate;
@interface MSRESTRequest : NSObject <NSURLConnectionDelegate, RPLoginViewControllerDelegate>
{
id<MSRESTRequestDelegate>__unsafe_unretained delegate;
BOOL _sucessResponse;
BOOL _isProcessing;
BOOL _autoLoginAttempt;
NSString *_method;
NSString *_ressource;
NSArray *_parameters;
-(void)executeBlockRequest:(void (^)(NSJSONSerialization *, MSJSonError *))handler
{
[NSURLConnection sendAsynchronousRequest:[self constructRequest] queue:[NSOperationQueue currentQueue] completionHandler:^(NSURLResponse *res, NSData *data, NSError *error){
NSJSONSerialization *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
if (error) {
MSJSonError *errorRest = [[MSJSonError alloc]init];
errorRest.name = error.description;
errorRest.name = error.description;
handler(json, errorRest);
}
package your.testpro;
import java.util.ArrayList;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.BaseAdapter;