This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See http://mindsea.com/2012/12/18/downscaling-huge-alassets-without-fear-of-sigkill for details | |
#import <AssetsLibrary/AssetsLibrary.h> | |
#import <ImageIO/ImageIO.h> | |
// Helper methods for thumbnailForAsset:maxPixelSize: | |
static size_t getAssetBytesCallback(void *info, void *buffer, off_t position, size_t count) { | |
ALAssetRepresentation *rep = (__bridge id)info; | |
NSError *error = nil; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module LambdasSVG where | |
import System.IO | |
import Data.String | |
import System.Random | |
writeSVG :: [String] -> String | |
writeSVG [] = error "No data to be written" | |
writeSVG xs = "<svg xmlns=\"http://www.w3.org/2000/svg\">" ++ foldr (++) "" xs ++ "</svg>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// This is an implementation of an asynchronous operation subclass. | |
// BASED ON: ConcurrentOperation.swift: Created by Caleb Davenport on 7/7/14. | |
// The original implementation has been completed with specific links to the documentation in order | |
// to make sure all the guidelines for subclassing an async operation are followed and learn more about | |
// how it should be correctly implemented, as well as having links available to help our memory to remember all | |
// the requirements a subclass of NSOperation should fullfit when it runs asynchronously. | |
// | |
// From Apple Docs: | |
// If you are creating a concurrent operation, you need to override the following methods and properties at a minimum: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MySynchronousOperation.swift | |
// operationqueues | |
// | |
// Created by Barbara Rodeker on 3/3/16. | |
// Copyright © 2016 Barbara M. Rodeker. All rights reserved. | |
// | |
// This program is free software: you can redistribute it and/or modify | |
// it under the terms of the GNU General Public License as published by | |
// the Free Software Foundation, either version 3 of the License, or |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// An Observer class intended to show how KVO works on operations and queues | |
// | |
// Created by Barbara Rodeker on 3/3/16. | |
// | |
// This program is free software: you can redistribute it and/or modify | |
// it under the terms of the GNU General Public License as published by | |
// the Free Software Foundation, either version 3 of the License, or | |
// (at your option) any later version. | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'telegram/bot' | |
require 'google_places' | |
token = 'YOUR-TOKEN-FOR-BOT' | |
@googleClient = GooglePlaces::Client.new('YOUR-GOOGLE-PLACES-TOKEN') | |
Telegram::Bot::Client.run(token) do |bot| | |
bot.listen do |message| | |
if message.location | |
l = message.location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see: https://www.youtube.com/watch?v=Y3t8e_rUyTk&list=PLwu90VQm-yTobHYmgVdvZu5sBdyPPxW9S and http://ladyandtech.blogspot.de/2016/03/swift-testing-with-xctest.html | |
import XCTest | |
@testable import YOUR_MODULE_NAME | |
class yourTestCase: XCTestCase { | |
override func setUp() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// This is how you could use standar user defaults for sharing app between your app and your extensions. | |
/// You should have groups capability enable in your app and extensions and use the same group name everywhere. | |
/// For more info see: https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html | |
/// -initWithSuiteName: initializes an instance of NSUserDefaults that searches the shared preferences search list for the domain 'suitename'. For example, using the identifier of an application group will cause the receiver to search the preferences for that group. Passing the current application's bundle identifier, NSGlobalDomain, or the corresponding CFPreferences constants is an error. Passing nil will search the default search list. | |
if let defaults = UserDefaults(suiteName: "yourapp.group.name") { | |
defaults.set("VALUE", forKey: "KEY") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
// In iOS 8 and later, apps that use either local or remote notifications must register the types of user interactions the app supports. Apps can ask to badge icons, display alert messages, or play sounds. When you request any of these interaction types, the system checks the types of interactions the user has allowed for your app. If the user has disallowed a particular type of interaction, the system ignores attempts to interact with the user in that way. | |
// The user can change the notification settings for your app at any time using the Settings app. Because settings can change, always call the registerUserNotificationSettings: at launch time and use the application:didRegisterUserNotificationSettings: method to get the response. | |
let center = UNUserNotificationCenter.current() | |
center.requestAuthorization(opt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
// In iOS 8 and later, apps that use either local or remote notifications must register the types of user interactions the app supports. Apps can ask to badge icons, display alert messages, or play sounds. When you request any of these interaction types, the system checks the types of interactions the user has allowed for your app. If the user has disallowed a particular type of interaction, the system ignores attempts to interact with the user in that way. | |
// The user can change the notification settings for your app at any time using the Settings app. Because settings can change, always call the registerUserNotificationSettings: at launch time and use the application:didRegisterUserNotificationSettings: method to get the response. | |
let center = UNUserNotificationCenter.current() | |
center.requestAuthorization(opt |
OlderNewer