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
#just testin' | |
puts "hallo welt" |
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
int x = 0; | |
x++; | |
if (x > 10) | |
cout << "Hola Mundo" << endl; |
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
function [nrows, ncols, nslices] = fieldsize(cols, slices) | |
%cols = 102; % in this particular case FieldSize / 0.0977 right now an even number is necessary | |
%slices = 40; %in this particular case FieldSize / 0.25 right now an even number is necessary | |
%edgeS.rows = repmat(256,1,squareFieldSizeCols*squareFieldSizeSlices); | |
%edgeS.cols = repmat((256-squareFieldSizeCols/2+1):(256+squareFieldSizeCols/2),1,squareFieldSizeSlices); % 512 / 2 => 256 | |
%edgeS.slices = repmat((64-squareFieldSizeSlices/2+1):(64+squareFieldSizeSlices/2),1,squareFieldSizeCols) %1 | |
ncols = zeros(1,cols*slices); | |
i = 1; | |
for v=(256-cols/2+1):(256+cols/2) |
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
--Proposed solutions to problems 87,88 and 89 of "99 Haskell Problems" | |
--Not optimal but they work | |
--If you know haskell and want to solve some problems there are some missing at: | |
--http://www.haskell.org/haskellwiki/99_questions/80_to_89 | |
import Data.List | |
type Node = Int | |
type Edge = (Node,Node) | |
type Graph = ([Node],[Edge]) |
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
// Delegate method from the CLLocationManagerDelegate protocol. | |
- (void)locationManager:(CLLocationManager *)manager | |
didUpdateToLocation:(CLLocation *)newLocation | |
fromLocation:(CLLocation *)oldLocation | |
{ | |
[self.locationManager stopUpdatingLocation]; | |
NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%0.6f,%0.6f&daddr=%@,%@", | |
newLocation.coordinate.latitude, | |
newLocation.coordinate.longitude, |
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
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier | |
{ | |
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | |
if (self) { | |
NSArray *screens=[[NSBundle mainBundle] loadNibNamed:@"StatusViewTableViewCell" owner:self options:nil]; | |
[self addSubview:[screens objectAtIndex:0]]; | |
} | |
return self; | |
} |
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
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; | |
UITabBarController *tbc = [[UITabBarController alloc] init]; | |
UINavigationController *nvc = [[UINavigationController alloc] init]; | |
StreamViewController *vc = [[StreamViewController alloc] init]; | |
vc.title = @"Vampire Or Not"; | |
[nvc pushViewController:vc animated: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
- (void) publishToFacebook:(NSData*)image withMessage:(NSString*)message { | |
NSMutableDictionary *params = [[NSMutableDictionary alloc] init]; | |
[params setValue:message forKey:@"message"]; | |
[params setValue:image forKey:@"source"]; | |
[[[Util sharedInstance] facebook] requestWithGraphPath:@"me/photos" | |
andParams:params | |
andHttpMethod:@"POST" | |
andDelegate:self]; | |
[params release]; | |
} |
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
+(BOOL) loadSession { | |
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | |
if (![defaults objectForKey:ACCESS_TOKEN_KEY] || | |
![defaults objectForKey:EXPIRATION_DATE_KEY] || | |
![defaults objectForKey:FACEBOOK_USER]) { | |
[Util clearSession]; | |
return NO; | |
} | |
Facebook *facebook = [[Util sharedInstance] facebook]; |
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
+ (NSString *)getMacAddress | |
{ | |
int mgmtInfoBase[6]; | |
char *msgBuffer = NULL; | |
size_t length; | |
unsigned char macAddress[6]; | |
struct if_msghdr *interfaceMsgStruct; | |
struct sockaddr_dl *socketStruct; | |
NSString *errorFlag = NULL; | |
OlderNewer