Skip to content

Instantly share code, notes, and snippets.

View designablebits's full-sized avatar
🎯
Focusing

Designable Bits designablebits

🎯
Focusing
View GitHub Profile
@designablebits
designablebits / UIImageTintCGExtension.swift
Created March 29, 2018 08:27 — forked from alexruperez/UIImageTintCGExtension.swift
UIImage tint with UIColor in Swift
extension UIImage
{
func tint(color: UIColor, blendMode: CGBlendMode) -> UIImage
{
let drawRect = CGRectMake(0.0, 0.0, size.width, size.height)
UIGraphicsBeginImageContextWithOptions(size, false, scale)
let context = UIGraphicsGetCurrentContext()
CGContextClipToMask(context, drawRect, CGImage)
color.setFill()
UIRectFill(drawRect)
@designablebits
designablebits / AppDelegate.swift
Last active December 6, 2018 13:27
Check user inactivity/idle time since last screen touch
//
// AppDelegate.swift
// Let's do this app
//
// Created by Sanjeev on 06.12.18.
// Copyright © 2018 Sanjeev. All rights reserved.
//
import UIKit
@designablebits
designablebits / TeachYourselfCS.md
Last active November 19, 2018 09:38
Teach Yourself Computer Science. If you’re a self-taught engineer or bootcamp grad, you owe it to yourself to learn computer science. Thankfully, you can give yourself a world-class CS education without investing years and a small fortune in a degree program 💸. This gist is based on www.teachyourselfcs.com website.

Teach Yourself Computer Science

If you’re a self-taught engineer or bootcamp grad, you owe it to yourself to learn computer science. Thankfully, you can give yourself a world-class CS education without investing years and a small fortune in a degree program 💸.

There are plenty of resources out there, but some are better than others. You don’t need yet another “200+ Free Online Courses” listicle. You need answers to these questions:

  • Which subjects should you learn, and why?
  • What is the best book or video lecture series for each subject?

This guide is our attempt to definitively answer these questions.

@designablebits
designablebits / Extension.swift
Last active November 19, 2018 08:47
A Collection of code snippets for my reference for iOS project, (UPDATED on regular basis).
//MARK: 01
extension UIView {
// Using a function since `var image` might conflict with an existing variable
// (like on `UIImageView`)
func asImage() -> UIImage {
if #available(iOS 10.0, *) {
let renderer = UIGraphicsImageRenderer(bounds: bounds)
return renderer.image { rendererContext in
layer.render(in: rendererContext.cgContext)
}
@designablebits
designablebits / TeachYourselfProgramming.md
Last active November 21, 2018 17:13
Several people have asked what programming language they should learn first. There is no one answer, but consider these points: Based on post by Peter Norvig (https://www.norvig.com/21-days.html)

Teach Yourself Programming in Ten Years

Peter Norvig

Why is everyone in such a rush?

Walk into any bookstore, and you'll see how to Teach Yourself Java in 24 Hours alongside endless variations offering to teach C, SQL, Ruby, Algorithms, and so on in a few days or hours. The Amazon advanced search for [title: teach, yourself, hours, since: 2000 and found 512 such books. Of the top ten, nine are programming books (the other is about bookkeeping). Similar results come from replacing "teach yourself" with "learn" or "hours" with "days."

The conclusion is that either people are in a big rush to learn about progra

@designablebits
designablebits / Bookmarks.md
Last active November 23, 2018 13:12
Thats mine :)
@designablebits
designablebits / InterviewQs.md
Last active January 23, 2019 14:10
Interview Questions to ask iOS and Android Developers.

How I Interview

A student recently asked for iOS interview tips. I’ve interviewed hundreds of candidates, and whiteboard coding only makes up a small part of my interview. Some of our best hires came with virtually no iOS background. Based on what I look for, I’ve settled on this format.

Your Current Project

I warm up with, “Anything cool you’ve been working on lately?”

These questions provide context. If you’re coming from games, I won’t ask about REST APIs. If you’ve been working on Android, I’ll keep my questions platform agnostic.

Your Hardest Problem

What’s the hardest technical challenged you’ve encountered? How did you go about solving it? I guess this is a behavioral question. Recruiters love them because, supposedly, past patterns are the best predictor of future performance.

@designablebits
designablebits / UITableView.swift
Created February 4, 2019 18:13
A generic UITableView cell register / dequeue in Swift
extension UITableView {
func register<T: UITableViewCell>(_: T.Type, reuseIdentifier: String? = nil) {
self.register(T.self, forCellReuseIdentifier: reuseIdentifier ?? String(describing: T.self))
}
func dequeue<T: UITableViewCell>(_: T.Type, for indexPath: IndexPath) -> T {
guard
let cell = dequeueReusableCell(withIdentifier: String(describing: T.self),
for: indexPath) as? T
@designablebits
designablebits / SwiftIntegerGuide.swift
Created March 7, 2019 05:41 — forked from kharrison/SwiftIntegerGuide.swift
Swift Integer Quick Guide
// -------------------------------------
// Swift Integer Quick Guide
// -------------------------------------
// Created by Keith Harrison http://useyourloaf.com
// Copyright (c) 2017 Keith Harrison. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
# Swift useful and common gists