This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Directive, ElementRef, HostBinding, OnDestroy, OnInit } from '@angular/core'; | |
import { AbstractControl, NgControl } from "@angular/forms"; | |
import { Subscription } from "rxjs"; | |
@Directive({ | |
selector: '[formControl], [formControlName]', | |
}) | |
export class ControlValidityClassDirective implements OnInit, OnDestroy { | |
@HostBinding('class.is-valid') | |
isValid = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import transaction | |
from rest_framework import mixins | |
from rest_framework.viewsets import GenericViewSet | |
__all__ = ['AtomicCreateModelMixin', 'AtomicUpdateModelMixin', 'AtomicDestroyModelMixin', | |
'AtomicModelViewSetMixin', 'AtomicModelViewSet'] | |
class AtomicCreateModelMixin(mixins.CreateModelMixin): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import msgpack | |
import time | |
import json | |
import pickle | |
l = [1,2,3] | |
l_packed = msgpack.packb(l) | |
l_json = json.dumps(l) | |
l_pickle = pickle.dumps(l) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface NSString (Additions) | |
- (NSString *)stringByReplacingSubstringsAtRanges:(NSArray *) rangeValues | |
withStrings:(NSArray *)strings; | |
@end |