Skip to content

Instantly share code, notes, and snippets.

View scottmkroberts's full-sized avatar

Scott Roberts scottmkroberts

  • Advance Labs
  • Peterborough, UK
View GitHub Profile
@scottmkroberts
scottmkroberts / UITableViewSnippet
Last active December 14, 2015 00:39
Just UITableView Snippet (because i can never be bothered to type this all out)
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 0;
}
@scottmkroberts
scottmkroberts / UIBezierPathRoundedCorner
Created February 20, 2013 22:34
Multiple Rounded corners with UIBezierPath using the | character
// Create the path (with only the top-left corner rounded)
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:_categoryColorView.bounds
byRoundingCorners:UIRectCornerTopLeft |
UIRectCornerBottomLeft
cornerRadii:CGSizeMake(10.0, 10.0)];
// Create the shape layer and set its path
CAShapeLayer *maskLayerTop = [CAShapeLayer layer];
maskLayerTop.frame = _categoryColorView.bounds;
#pragma mark - Table View Data Source
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
return 0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
@scottmkroberts
scottmkroberts / CRC16-Javascript.js
Created February 29, 2012 19:57
CRC-16 Hash Computation for Case Labels
console.log("hello CRC16");
function CreateCrc16(){
var polynomial,value,temp;
var table=new Array(256);
polynomial=40961;
for(i=0;i<table.length;++i){
value=0;temp=i;
@scottmkroberts
scottmkroberts / Buzz Fizz
Created November 7, 2011 20:16
Objective C - test 1
#import <Foundation/Foundation.h>
/* Test I had to do, Took me way to long so thought I would draft it up in objective c
basically getting the remainder using the % modular type.
loop through to 100, if number is divisible by 3 print buzz if its divisible by 5 print fizz and if its both print buzz fizz. Else just print the number.
*/
int main(int argc, char *argv[]) {
NSString *string = [NSString alloc] initWithStringFormat:@"%i", 3];