Skip to content

Instantly share code, notes, and snippets.

View mteece's full-sized avatar

Matthew Teece mteece

View GitHub Profile
@mteece
mteece / RecordResposeObject.cs
Created November 2, 2011 20:07
C# wrapper for generic objects response. Useful for objects in WCF with Ajax and JSON.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
/*
using My.Domain.Namespace;
@mteece
mteece / gist:d16b1298b677d0f75e44
Created November 7, 2014 17:03
Adding kdiff3 two Windows Git as mergetool.

Either add this to your gitconfig:

[merge]
    tool = kdiff3
[mergetool "kdiff3"]
    cmd = \"C:\\\\Program Files\\\\KDiff3\\\\kdiff3\" $BASE $LOCAL $REMOTE -o $MERGED

Or run These at the command line:

$ git config --global merge.tool kdiff3

@mteece
mteece / timezone.md
Last active July 29, 2022 22:12
List of NSTimeZone Abbreviations and Names (iOS 9.3.1)

NSTimeZone - Timezone Abbreviations ADT = "America/Halifax"; AKDT = "America/Juneau"; AKST = "America/Juneau"; ART = "America/Argentina/Buenos_Aires"; AST = "America/Halifax"; BDT = "Asia/Dhaka"; BRST = "America/Sao_Paulo"; BRT = "America/Sao_Paulo"; BST = "Europe/London";

@mteece
mteece / find_match.swift
Last active March 9, 2021 20:15
Design a function that takes two string parameters. The function should return the longest substring that fully matches the provided pattern. Assume that the input and pattern characters are alphabetic.
import UIKit
import Foundation
/** Design a function that takes two string parameters:
input
pattern
The function should return the longest substring that fully matches
the provided pattern. Assume that the input and pattern characters are
alphabetic.
@mteece
mteece / EmailRepository.h
Created October 18, 2013 14:57
Objective-C blocks and Grand Central Dispatch. Using GCD and blocks effectively.
#import <Foundation/Foundation.h>
@interface EmailRepository : NSObject
+ (id)sharedEmailRepository;
- (void)getDataFromServer:(NSString *)emailAddress onComplete:(void (^)(NSString *response))completionBlock onFailure:(void (^)(NSString *response))failureBlock;
@end
@mteece
mteece / Ext.ux.form.MultiSelect.js
Created August 8, 2012 18:53
Ext.ux.form.MultiSelect from Ext JS 4.0.7/4.1.1. It is missing the select/deselect functions that would highlight records in the objects store.
/**
* @class Ext.ux.form.MultiSelect
* @extends Ext.form.field.Base
* A control that allows selection and form submission of multiple list items.
*
* @history
* 2008-06-19 bpm Original code contributed by Toby Stuart (with contributions from Robert Williams)
* 2008-06-19 bpm Docs and demo code clean up
*
* @constructor
@mteece
mteece / exampleTableView.m
Created February 10, 2016 16:37
Fix for heightForHeaderInSection as it is called before viewForHeaderInSection and the view size until I create it.
- (CGSize)tableView:(UITableView *)tableView sizeForHeaderLabelInSection:(NSInteger)section
{
NSString *text = [self tableView:tableView titleForHeaderInSection:section];
CGSize constraint = CGSizeMake(self.view.frame.size.width - kSectionTitleLeftMargin - kSectionTitleRightMargin, kMaxSectionTitleHeight);
return [text sizeWithFont:[self fontForSectionHeader] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
@mteece
mteece / uiviewcontroller-sequences.m
Created August 22, 2016 18:37
UIViewController sequences
the proper sequence is
-(void)initWithCoder
-(void)awakefromNib //(if story board is used)
or
-(void)loadView----() //if manually generating the view contoller
-(void)viewDidLoad-----(called only once in the life cycle of viewController)
-(void)viewWillAppear
-(void)viewDidAppear
@mteece
mteece / AppDelegate.m
Created June 8, 2016 20:06
Passing RLMResults into a RLMArray for use in swapping objects. To avoid using sort index properties and rely on the array indices.
#import "AppDelegate.h"
#import <Realm/Realm.h>
// Define your models
@interface Dog : RLMObject
@property NSString *name;
@property NSInteger age;
@end
@implementation Dog
@mteece
mteece / bennett.cs
Created November 26, 2013 15:32
Let off some steam, Bennett.
static void Main()
{
Console.WriteLine(@"
LET OFF SOME STEAM, BENNETT.
'''';;;;;;;;;;;';;;''';::,,,:::::::;''++++++++++++
;;;::::;;;;;;;;'++#'';;::,,,:::;;::;''++++++++++++
;;::::::::;;;;##++#@#';;:,,:::;;;;;;''++++++++++++
;;::::::::;;;#+,,,,;;+;;:::::;;'';;;'''+++++++++++