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
{
root: {
"objects" : {
"$object_id" : {
"permissions" : {
"isPublic" : BOOL,
"users" : {
"$user_id" : BOOL
}
},
{
"rules" : {
"$user_id" : {
".read" : "auth.uid == $user_id", // can read if $user_id matches current user
".write" : "auth.uid == $user_id", // can read if $user_id matches current user
".validate" : "newData.val().isString()" // new data must be string
}
}
}
{
root: {
"objects" : {
"$object_id" : {
"permissions" : {
"isPublic" : BOOL,
"users" : {
"$user_id" : BOOL
}
},
- (void)updateSection:(NSUInteger)section
withData:(nonnull NSArray *)data
insertionAnimation:(UITableViewRowAnimation)insertionAnimation
deletionAnimation:(UITableViewRowAnimation)deletionAnimation
getter:(nonnull NSArray * _Nonnull(^)(void))getter
setter:(nonnull void (^)(NSArray * _Nonnull data))setter
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;
- (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