Skip to content

Instantly share code, notes, and snippets.

View page_text.dart
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
void main() => runApp(MyApp());
const sampleText = '''
Flutter is an open-source UI software development kit created by Google.
It is used to develop applications for Android, iOS, Linux, Mac, Windows, Google Fuchsia,[4] and the web from a single codebase.[5]
burhanaksendir / gist:aecbebd67793e1fb9613
Created Jul 22, 2015
avenir font family name for UIFont
View gist:aecbebd67793e1fb9613
* AvenirNextFontType collects all available fonts in the Avenir Next family. To be used with [UIFont(AvenirNext) avenirNextFontOfType:size:]
typedef NS_ENUM(NSUInteger, AvenirNextFontType)
* Font named AvenirNext-Regular.
View gist:d9731505c9f64bf0fe3e
import UIKit
class demoViewController: UIViewController, UIPopoverPresentationControllerDelegate {
override func viewDidLoad() {
burhanaksendir / gist:4fd2c3591145de87448b
Created Jul 10, 2015
Save full screenshot including bars - swift
View gist:4fd2c3591145de87448b
func captureScreen() -> UIImage {
let layer: CALayer = UIApplication.sharedApplication().keyWindow!.layer
let scale: CGFloat = UIScreen.mainScreen().scale
UIGraphicsBeginImageContextWithOptions(layer.frame.size, layer.opaque, scale)
let image = UIGraphicsGetImageFromCurrentImageContext()
return image
burhanaksendir / ViewController
Created Jul 9, 2015
Açılıp Kapanan Yan Menü :)
View ViewController
// ViewController.swift
// SideMenu
// Created by Burhan Aksendir on 9.07.2015.
// Copyright (c) 2015 Aksendir. All rights reserved.
import UIKit
burhanaksendir / gist:216c446f03b09fa1e27d
Created Jul 8, 2015
iOS - UIBarButtonItem Settings Gear
View gist:216c446f03b09fa1e27d
let gearTitle = NSString(string: "\u{2699}") as String
let fontStyle = [NSFontAttributeName: UIFont(name: "Avenir Next", size: 27)!]
let settingsButton = UIBarButtonItem(title: gearTitle, style: UIBarButtonItemStyle.Plain, target: self, action: Selector("showSettingsVC:"))
settingsButton.setTitleTextAttributes(fontStyle, forState: UIControlState.Normal)
View BookViewController
class BookViewController: UIViewController {
var book: UIView!
var content: NSMutableArray!
var currentPage: Int = 0
var font: UIFont!
override func viewDidLoad() {
burhanaksendir / remoteFileExists
Created Jun 23, 2015
How to check if a remote file exists in Swift ?
View remoteFileExists
func remoteFileExists(url: String) -> Bool {
var exists: Bool = false
let url: NSURL = NSURL(string: url)!
var request: NSMutableURLRequest = NSMutableURLRequest(URL: url)
request.HTTPMethod = "HEAD"
var response: NSURLResponse?
NSURLConnection.sendSynchronousRequest(request, returningResponse: &response , error: nil)
View gist:2e84877396670533a5ba
override func viewDidLoad() {
NSNotificationCenter.defaultCenter().addObserver(self, selector: "remoteNotificationReceiveAction:", name: "remoteNotificationReceived", object: nil)
func remoteNotificationReceiveAction(data: NSNotification) {
if let apsPayloadContent: AnyObject = data.userInfo as? AnyObject {
View gist:02820df6d0f1c335d6f9
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Parse initialization
Parse.setApplicationId(“xxxxxxxxxxxxxxxx", clientKey: “xxxxxxxxxxxxx")
let types = UIUserNotificationType.Badge | UIUserNotificationType.Alert | UIUserNotificationType.Sound
let settings = UIUserNotificationSettings(forTypes: types, categories: nil)
return true