Skip to content

Instantly share code, notes, and snippets.

View jagbolanos's full-sized avatar

Jorge Garcia jagbolanos

View GitHub Profile
@jagbolanos
jagbolanos / gist:1731067
Created February 3, 2012 16:47
Load XiB for TableViewCell
- (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;
}
@jagbolanos
jagbolanos / gist:1724258
Created February 2, 2012 16:07
Get Directions
// 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,
@jagbolanos
jagbolanos / dfsalgorithms.hs
Created March 5, 2011 23:37
Some DFS based graph algorithms in Haskell
--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])
@jagbolanos
jagbolanos / fieldsize.m
Created March 3, 2011 21:31
Create a rectangular field
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)
int x = 0;
x++;
if (x > 10)
cout << "Hola Mundo" << endl;
#just testin'
puts "hallo welt"