Snippets

Quick bits and pieces that could save you a lifetime!

Change audio output channel in iOS

January 31, 2019

If you application is playing some sort of sound, perhaps music, you want to allow the user to be able to change the output source. Current Apple does not have an easy way for you to programmatically…

Gaussian Elimination of Matrices in Matlab

January 31, 2019

Gaussian elimination uses Elementary Matrix Operations to yield a pair of lower & higher triangle matrices for which: Gaussian Elimination without a pivot: Gaussian Elimination with pivoting:

Special literals to get current line number in Swift

January 31, 2019

One interesting feature that Swift has are the idea of special literals. The literals are unique in the way that they are able to obtain information about the code themselves. Let's take a look at…

What is "use strict" in Javascript?

January 31, 2019

Use strict is a feature introduced in ES5, where adding the string "use strict" to a context in your JS code will opt it into a stricter variant of Javascript, where certain unsafe actions are not…

How to check if an element in hidden in Javascript

January 30, 2019

This question is commonly asked around the web. In many cases with complex UIs you'd like to know if an element is currently hidden or visible, that's if you don't already keep track of this in a…

How to programmatically determine the current iPhone device

January 30, 2019

In many instances as an iOS developer you may want to know which device is currently running the application. In my experience, I would use this very often since I code without storyboards and layout…

How to add tap function to UIButton

January 29, 2019

One of the most annoyances in iOS development is to programmatically handle a tap action for a . In Android all views have an which removes the need to use and and creating a separate function…

Search by