Skip to content

Instantly share code, notes, and snippets.

View saniul's full-sized avatar

saniul saniul

View GitHub Profile
Privacy Policy
We have written our privacy policy to be understandable for humans (not just lawyers). By using our Moves app (the “App”), future products, services or features we develop and introduce, or our website (together the “Services”), you consent to the collection, processing and disclosure of data concerning you in accordance with this privacy policy.
Data collection and processing
Moves collects data from your phone to provide you with an easy way to track how and where you move in your everyday life. When you install, run or use our services we collect:
Location. Our system starts to collect location data from sources such as GPS, Wi-Fi and cell towers once you install the App and consent to the App’s tracking your location. We also collect Accelerometer samples, Wi-Fi network IDs, activity data, and places you identify with the Services. You may choose to stop our collection of location data through the Settings that we provide in the App, or by removing the App from your phone.
Information y
@saniul
saniul / gist:00daf8cc04e5bda20059
Created June 20, 2014 21:53
UIBezierPath Bug
+ (UIImage *)imageForCollageProxyWithType:(NSString *)collageType
highlightedIndex:(NSUInteger)highlightedIndex
fillColor:(UIColor *)fillColor
highlightedFillColor:(UIColor *)highlightedFillColor
size:(CGSize)size {
CGFloat scale = 2;
size.height *= scale;
size.width *= scale;

Keybase proof

I hereby claim:

  • I am saniul on github.
  • I am saniul (https://keybase.io/saniul) on keybase.
  • I have a public key whose fingerprint is C2AB 28BB AE7B 1968 FA1A 1D3C 35AC 0736 AB80 5943

To claim this, I am signing this object:

@saniul
saniul / gist:d478b5537854a14e34dd
Created November 1, 2014 05:34
Corrected NSHipster Raw​Option​Set​Type
struct Toppings : RawOptionSetType/*, BooleanType*/ {
var rawValue: UInt = 0
init(nilLiteral: ()) {
}
init(rawValue value: UInt) {
self.rawValue = value
@saniul
saniul / gist:d429c9d0114e4fed6108
Created November 1, 2014 05:41
Corrected NSHipser RawOptionSetType Xcode Snippet
struct <# Options #> : RawOptionSetType {
var rawValue: UInt = 0
init(nilLiteral: ()) { }
init(rawValue: UInt) { self.rawValue = rawValue }
static func fromMask(raw: UInt) -> <# Options #> { return self(rawValue: raw) }
static func fromRaw(raw: UInt) -> <# Options #>? { return self(rawValue: raw) }
func toRaw() -> UInt { return self.rawValue }
static var allZeros: <# Options #> { return self(rawValue: 0) }
@saniul
saniul / NavStyleBug.swift
Created January 23, 2015 09:11
UINavigationBar styling between UINavigationController transitions
// NavStyleBug
//
// Created by Saniul Ahmed on 22/01/2015.
// Copyright (c) 2015 Saniul Ahmed. All rights reserved.
//
import UIKit
//MARK: Environment
// Playground - noun: a place where people can play
//Dynamic Casting in Swift
//http://blog.segiddins.me/2015/01/25/dynamic-casting-in-swift/
let json: NSDictionary = ["count":123,"name":"foobar"]
func id<U>(object: AnyObject?) -> U? {
if let typed = object as? U {
return typed
//Based on https://github.com/klmr/named-operator
// Playground - noun: a place where people can play
struct NamedOperator<T1, T2, R> {
let f: (T1, T2) -> R;
};
struct NamedOperatorLHS<T1, T2, R> {
let f: (T1, T2) -> R;
//
// MultiDirectionAdjudicatingScrollView.swift
// Khan Academy
//
// Created by Andy Matuschak on 12/16/14.
// Copyright (c) 2014 Khan Academy. All rights reserved.
//
import UIKit
import UIKit.UIGestureRecognizerSubclass
@saniul
saniul / gist:9f467d51859533006fd8
Created February 12, 2015 21:45
Apple Testflight User Export Bookmarklet
javascript: (function(){var t={eval:'"(function(){var t=artoo.scrape(\\".table-testers tbody tr\\",{name:function(t){return t(this).find(\\".tt-name span:first\\").text().trim()},email:function(t){return t(this).find(\\".tt-email span:first\\").text().trim()},status:function(t){return t(this).find(\\".tt-status span:first\\").text().trim()},latestBuild:function(t){return t(this).find(\\".tt-latest-build span:first\\").text().trim()}});artoo.saveCsv(t)}).call(this,artoo.$);"'},e=!0;if("object"==typeof this.artoo&&(artoo.settings.reload||(artoo.log.verbose("artoo already exists within this page. No need to inject him again."),artoo.loadSettings(t),artoo.hooks.trigger("exec"),e=!1)),e){var i=document.getElementsByTagName("body")[0];i||(i=document.createElement("body"),document.firstChild.appendChild(i));var a=document.createElement("script");console.log("artoo.js is loading..."),a.src="//medialab.github.io/artoo/public/dist/artoo-latest.min.js",a.type="text/javascript",a.id="artoo_injected_script",a.setAttribute