Skip to content

Instantly share code, notes, and snippets.

View EchoAbstract's full-sized avatar

Brian Wilson EchoAbstract

  • TrustCloud
  • Boston, MA
View GitHub Profile
@EchoAbstract
EchoAbstract / setGetMap.m
Created May 4, 2012 18:38
Setter, Getter and Mapping Function
// Setter for 'coordinate' property
- (void)setCoordinate:(CLLocationCoordinate2D)newCoordinate
{
// Update the coordinateArray with the coordinate information
self.coordinateArray = [NSArray arrayWithObjects:
[NSNumber numberWithDouble:newCoordinate.longitude],
[NSNumber numberWithDouble:newCoordinate.latitude], nil];
}
// Getter for 'coordinate' property
@EchoAbstract
EchoAbstract / header.m
Created May 4, 2012 18:38
KCSPersistable
@interface KGAMapNote : NSObject <MKAnnotation, KCSPersistable>
// In your view controller
// Make sure you have a class that stores image metadata
// For example, you could have your MyMetadata class with
// the following iVars:
// name -- The name of the image
// size -- The expected size of the image
// date -- The time the picture was taken
// location -- The place the image was taken
// peopleInPhoto -- An array of the 'id' attribute from KCSUsers
// in the picture
// To create a coupon or storecard feature in your app
// you can do the following
@interface Card : NSObject <KCSPersistable>
@property (nonatomic, retain) NSString *cardId;
@property (nonatomic, retain) NSString *code;
@property (nonatomic, retain) NSString *cardName;
@property (nonatomic, retain) NSString *firstName;
@property (nonatomic, retain) NSString *lastName;
// This is in our CLLocationManagerDelegate
// Also, this code builds on https://github.com/Kinvey/KinveyGeoTag
// from the blog: http://www.kinvey.com/blog/item/155-ios-corner-taking-your-mobile-local-using-kinvey-for-location-based-apps
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
// This class assumes that you ask the user if they want to share their location
@EchoAbstract
EchoAbstract / dbManager.coffee
Created June 25, 2012 22:49 — forked from ivanstoyanov/dbManager.coffee
Node/Mongo Replica set connect string
mongo = require 'mongodb'
# full connect string
mongodbURI = "mongodb://
#{process.env.MONGO_USER}:#{process.env.MONGO_PASSWORD}@
mongoA.company.com,mongoB.company.com,mongoC.company.com/
admin?replicaSet=company&autoReconnect=true&connectTimeoutMS=500"
# obtaining a connection is now simple
mongo.connect mongodbURI, (err, db) =>
@EchoAbstract
EchoAbstract / managedObject.m
Created June 26, 2012 19:57
Managed Object
@implementation managedObject
@synthesize managedObjectContext;
+ (NSDictionary *)kinveyObjectBuilderOptions
{
static NSDictionary *options = nil;
if (options == nil){
options = [NSDictionary dictionaryWithObjectsAndKeys:
@EchoAbstract
EchoAbstract / googleSpreadsheetToKinvey.js
Created July 30, 2012 14:19
Convert Google Spreadsheet into Kinvey Collections
function getKinveyParameters(){
return {
kinvey_app_id: " YOUR APP ID ",
kinvey_master_secret: " YOUR MASTER SECRET "
};
};
// Use this function for time based script updating, since
// the id is hard-coded
function readRowsHelper(){
@EchoAbstract
EchoAbstract / init.el
Created August 20, 2012 21:56
Some notes from init.el
; Syntax checking
(add-to-list 'load-path "~/Emacs/lintnode")
(require 'flymake-jslint)
;; Make sure we can find the lintnode executable
(setq lintnode-location "~/Emacs/lintnode")
;; JSLint can be... opinionated
(setq lintnode-jslint-excludes (list 'nomen 'plusplus 'onevar 'white))
;; Start the server when we first open a js file and start checking
(add-hook 'js-mode-hook
(lambda ()
@EchoAbstract
EchoAbstract / Coffeescript ctags
Created September 10, 2012 17:32 — forked from Talleyran/Coffeescript ctags
ctags definitions for Coffeescript. Very basic for now. "> ctags -e -R source_folder" and then M-. to jump to the definition of any function or variable (if you're using emacs)
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/^[ \t]*class ([a-zA-Z_$][0-9a-zA-Z_$]*).*$/\1/c,class/
--regex-coffee=/^[ \t]*([a-zA-Z_$@][0-9a-zA-Z_$\.]*)[ \t]*[:=].*[=-]>.*$/\1/f,function/
--regex-coffee=/^[ \t]*([a-zA-Z_$@][0-9a-zA-Z_$\.]*)[ \t]*=[^->\n]*$/\1/v,variable/