Skip to content

Instantly share code, notes, and snippets.

View mathewa6's full-sized avatar
๐Ÿ˜Š

adi mathewa6

๐Ÿ˜Š
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mathewa6
mathewa6 / LinkedListOperator.swift
Created November 24, 2016 23:58 — forked from nahive/LinkedListOperator.swift
Linked Lists in Swift using custom operator
// maybe someone will find this useful
// i was going through codewars and
// encountered linkedlist challenge
// i noticed special A -> B operator
// and i decided to recreate it it swift :)
//MARK: custom class that holds data
class Node<T> {
var data: T
var next: Node<T>?
@mathewa6
mathewa6 / FCPrivateBatteryStatus.m
Created March 15, 2016 01:30
How to get raw battery info (mAh remaining, etc.) from iOS using private APIs. For internal testing only, NOT APP STORE DISTRIBUTION!
#import <Foundation/Foundation.h>
#include <dlfcn.h>
NSDictionary *FCPrivateBatteryStatus()
{
static mach_port_t *s_kIOMasterPortDefault;
static kern_return_t (*s_IORegistryEntryCreateCFProperties)(mach_port_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, UInt32 options);
static mach_port_t (*s_IOServiceGetMatchingService)(mach_port_t masterPort, CFDictionaryRef matching CF_RELEASES_ARGUMENT);
static CFMutableDictionaryRef (*s_IOServiceMatching)(const char *name);
//
// SimpleScrollingStack.swift
// A super-simple demo of a scrolling UIStackView in iOS 9
//
// Created by Paul Hudson on 10/06/2015.
// Learn Swift at www.hackingwithswift.com
// @twostraws
//
import UIKit
@mathewa6
mathewa6 / The Technical Interview Cheat Sheet.md
Last active August 29, 2015 14:28 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
[
{
"action": {
"type": "block"
},
"trigger": {
"url-filter": ".*",
"resource-type": ["script"],
"load-type": ["third-party"],
"if-domain": ["imore.com"]
@mathewa6
mathewa6 / Algorithms.swift
Last active August 11, 2018 17:33
A review of basic algorithms in Swift, started after reading http://bost.ocks.org/mike/algorithms/
//A review thanks to http://bost.ocks.org/mike/algorithms/
import Foundation
func exchange<T>(inout elementsIn array: [T], i: Int, j: Int)
{
let temp: T = array[i]
array[i] = array[j]
array[j] = temp
}
//clang++ -std=c++11 -stdlib=libc++ -framework Foundation nsarray.mm -o nsarray
/* Note:
* - libstdc++ has been frozen by Apple at a pre-C++11 version, so you must opt
for the newer, BSD-licensed libc++
* - Apple clang 4.0 (based on LLVM 3.1svn) does not default to C++11 yet, so
you must explicitly specify this language standard. */
/* @file nsarray.mm
* @author Jeremy W. Sherman
*
* Demonstrates three different approaches to converting a std::vector
@mathewa6
mathewa6 / SwiftTour.swift
Created June 29, 2014 03:24
"A Swift Tour" : Experiment solutions
import Cocoa
println("Hello World")
//Experiment
let explicitFloat: Float = 4;
let width = explicitFloat
let label = "The width is "
//Experiment: Error
@mathewa6
mathewa6 / boolValueNSLogging.codesnippet
Created June 20, 2014 20:58
xcsnippet : BOOL Type Formatter
//BOOL Type Formatter
//Makeshift "Type Formatter" for boolean expressions in NSLog() statements.
//Completion Shortcut : boolValueNSLogging
//Completion Scope : All
NSLog(@"%@", <#BOOL_VALUE_EXPRESSION#> ? @"YES" : @"NO");