Ayush's Blog

  • Github Graphql Repository For Organization

    GraphQl query to get all repos for an organization is: { organization(login: ORGANIZATION_NAME) { repositories(first: 100, privacy: PRIVATE, orderBy: {field: CREATED_AT, direction: ASC}) { edges { node { name description diskUsage url sshUrl isFork isPrivate } cursor } } } } Check repository fields to check what all more fields...

  • Equal Sum Subset Partition Problem

    Problem is as specified on LeetCode - Partition Equal Subset Sum Requirements Array needs to be partitioned into two. Both parts should have equal sum. Approach 1. Each partition’s sum will be half of total Notice that, since we need only two partitions with equal sum, the sum of each...

  • Git Tips

    1. Create Github gists from terminal Use Homebrew to install gist. brew install gist gist --login to give OAuth access to the application so that it can create gists on your behalf. Otherwise it creates anonymous gists. Now read the documentation via gist -h and use it according to what...

  • Core Data Tips

    1. Notes Three types of concurrency available for NSManagedObjectContext Main thread linked to UI (NSMainQueueConcurrencyType) Private queue for background tasks (NSPrivateQueueConcurrencyType) Confinement for legacy (NSConfinementConcurrencyType) used with serialised dispatch_queue or NSOperationQueue with max concurrency one harder to manage To simplify usage of Core Data APIs, use NSMainQueueConcurrencyType View controllers and...

  • Skipping Posts In Jekyll Feed

    Problem: I needed a place to host simple pages when necessary for my personal apps. Like a privacy policy for my app. I don’t want to show it as a part of my blog (for obvious reasons). Solution: What I essentially need is a filter on all my posts to...

  • Thinking Functionally

    Functional programming doesn’t require you to work with only a functional language. The basic rules of it can be applied to any language you use. I took a 3 class session at Directi on the topic a few weeks back. Some of the important topics were covered, including: What is...

  • Handling Network Response

    Network query-responses are an integral part of software these days. We rely for configurations, user data, updates etc etc on data from network. Aim for code that handles a response (success or failure) should be: Readability should not be compromised, given a lot of error cases need to be handled....

  • iOS Non Responsive Window

    Recently I got a strange log: 1 unexpected nil window in __dispatchPreprocessedEventFromEventQueue, _windowServerHitTestWindow: <UIWindow: 0x618000079880; frame = (0 0; 375 667); autoresize = W+H; userInteractionEnabled = NO; gestureRecognizers = <NSArray: 0x6040000f45d0>; layer = <UIWindowLayer: 0x6030000aaf50>> This would happen whenever I tapped anywhere on the screen. No Google magic could explain...

  • Localisation in iOS

    Why you need localisation? Many people do NOT speak English. English is Second most used language after Mandarin. Wikipedia So by developing you app for only English (the usual development language), you are not reaching even the largest set of people in this world. Localising an app makes it available...

  • Resetting Text Margins in TextKit on iOS

    To set the UILabel to start the text from it’s bounds (without margins) set the properties as shown below. Reference: Mastering TextKit with Katsumi Kishikawa