Skip to content

Instantly share code, notes, and snippets.

View kenmhaggerty's full-sized avatar

Ken M. Haggerty kenmhaggerty

View GitHub Profile
- (void)setName:(NSString *)name {
NSString *primitiveName = [self primitiveValueForKey:NSStringFromSelector(@selector(name))];
if ((!name && !primitiveName) || [name isEqualToString:primitiveName]) {
return;
}
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
if (name) {
userInfo[@"object"] = name;
- (void)didSave {
[[NSNotificationCenter defaultCenter] postNotificationName:@"kPQSurveyDidSaveNotification" object:self userInfo:nil];
[super didSave];
}
@interface MyObject : NSManagedObject
@property (nonatomic, strong, nullable) NSSet *changedKeys;
@end
...
@interface MyObject
- (void)willSave {
[super willSave];
- (void)setName:(NSString *)name {
if ((!name && !_name) || [name isEqualToString:_name]) {
return;
}
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
if (name) {
userInfo[@"newValue"] = name;
}
var sheetName = "Sheet1"; // name of your sheet
var firstRowOfData = 2; // first row of data
var firstColumnOfData = 2; // first column of data where A = 1
var lastColumnOfData = 3; // last column of data where A = 1
function onEdit(e) {
Logger.log("[METHOD] onEdit(e)");
if (e.source.getActiveSheet().getName() !== sheetName) {
return; // don't continue if a non-relevant sheet was edited
- (void)updateFromArray:(nonnull NSArray *)array
toArray:(nonnull NSArray *)toArray
inSection:(NSUInteger)section
withInsertionAnimation:(UITableViewRowAnimation)insertionAnimation
deletionAnimation:(UITableViewRowAnimation)deletionAnimation
setter:(nonnull void (^)(NSArray * _Nonnull data))setterBlock
insertedCells:(nullable void (^)(NSArray <UITableViewCell *> * _Nonnull cells))insertionBlock
reorderedCells:(nullable void (^)(NSArray <UITableViewCell *> * _Nonnull cells))reorderingBlock
deletedCells:(nullable void (^)(NSArray <UITableViewCell *> * _Nonnull cells))deletionBlock
completion:(nullable void (^)(void))completionBlock
{
root: {
"objects" : {
"$object_id" : {
"permissions" : {
"isPublic" : BOOL,
"users" : {
"$user_id" : BOOL
}
},
{
root: {
"objects" : {
"$object_id" : {
"permissions" : {
"isPublic" : BOOL,
"users" : {
"$user_id" : BOOL
}
},
{
root: {
"objects" : {
"$object_id" : {
...
// data goes here
}
},
"permissions" : {
"public" : {
{
"rules" : {
"objects" : {
"$object_id" : {
// OBJECT
".read" : "root.child('permissions/public/'+$object_id).val() == true || root.child('permissions/user/'+auth.uid+'/'+$object_id).val() == true", // can read if public or if permitted user
".write" : "root.child('permissions/user/'+auth.uid+'/'+$object_id).val() == true" // can write if permitted user or logged in and no existing object
}
},
"permissions" : {