Skip to content

Instantly share code, notes, and snippets.

View cojoj's full-sized avatar

Mateusz Zając cojoj

View GitHub Profile
@cojoj
cojoj / issues.json
Created August 3, 2015 10:14
Xcode Server - integration issues response
{
"buildServiceErrors": [
{
"_id": "99e84a22b20df344df2217d5e4186094",
"_rev": "3-0cf0b25e995f1a050617d3c5824007f7",
"message": "This integration was canceled.",
"type": "buildServiceError",
"issueType": "Build Service Error",
"commits": [],
"integrationID": "99e84a22b20df344df2217d5e4183bce",
@cojoj
cojoj / solution.md
Last active February 2, 2016 22:19
Xcode Server license agreement

Playing with beta Xcode Server

I wanted to get may hands on this new and fancy Xcode Server, so I've jumped straight to installing beta Xcode and beta OS X Server - that was easy (as always), but... When I've opened OS X Server and switched to Xcode tab I had to choose Xcode which I want to use as Xcode Server - fine, but to easy tasks in a row can't complet with success. I get this rather confusing dialog:

You must agree to the terms of the Xcode software license agreement os x server

WTF!? I've accepted license agreement in both of my Xcodes (beta and regular one), so what more do you want from me, Apple? Okay, Google to the rescue!

sudo xcodebuild -license
@cojoj
cojoj / method.swift
Created July 2, 2015 20:22
Guard coverage
// Got this method which makes call to API, blah, blah, blah...
self.sendRequestWithMethod(.GET, endpoint: .Repositories, params: nil, query: nil, body: nil) { (response, body, error) -> () in
guard error == nil else {
completion(repositories: nil, error: error)
return
}
guard let repositoriesBody = (body as? NSDictionary)?["results"] as? NSArray else {
completion(repositories: nil, error: Error.withInfo("Wrong body \(body)"))
@cojoj
cojoj / error.swift
Last active August 29, 2015 14:22
ErrorType vs NSError
public class func parse(data: NSData) -> (AnyObject?, NSError?) {
do {
// From docs: If an error occurs, upon return contains an NSError object that describes the problem.
let obj = try NSJSONSerialization.JSONObjectWithData(data, options: .AllowFragments)
return (obj as AnyObject, nil)
} catch {
// But here I get: ErrorType is not convertible to NSError
return (nil, error)
}
}
@cojoj
cojoj / map.html
Created March 24, 2015 10:17
Phonegap map
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" />
<title>Niezbędnik Studenta</title>
<script type="text/javascript" src="cordova.js"></script>
@cojoj
cojoj / request.json
Last active August 29, 2015 14:16
Request
POST /app-review-tasks/7b144434-890a-467e-afc6-10ed68236f32?body=false HTTP/1.1
Authorization: Basic ZXlKaGJHY2lPaUpJVXpJMU5pSXNJbWxoZENJNk1UUXlNalExTmpFM01Dd2laWGh3SWpvek1EQXdNREF3TURFME1qSTBOVFl4TnpCOS5leUoxYzJWeVgybGtJam9pTkRReU5EQXlOekV0TkdOaU5DMDBPRFV3TFdFMFpHVXRZbVpsWm1JeVptVmpZMkk0SW4wLnhOem1qU2FUWWRIaUdzN2xUcXg3MG5henl0RWFfUmV3c0JpRG1KOU4zZk06
Cookie: session=eyJfaWQiOiIwY2RjOTdjYjdiYjYyMmQwNjZhMzQxZGEwOTdjYzRmOSJ9.B-LgKQ.L76F3sJrQEWHiT2mMqsd5ohgnmU
Host: ec2-54-173-238-232.compute-1.amazonaws.com
Connection: close
User-Agent: Paw/2.1.1 (Macintosh; OS X/10.10.2) GCDHTTPRequest
Content-Length: 231637
{
"image": "ÿØÿàJFIFÿíbPhotoshop 3.08BIMFtg(c) The Andy Warhol Foundation for the Visual Arts, Inc./ARS, NY and DACS, London 2009 / Photo (c) TateP07125P07125P07125P07125P07125P07125P07125i([no title] 1967 by Andy Warhol 1928-1987x[[no title] 1967 Andy Warhol 1928-1987 Purchased 1971 http://www.tate.org.uk/art/work/P07125ÿÛC
@cojoj
cojoj / beacons.md
Last active August 29, 2015 14:16
iBeacons generic UUIDs

iBeacons generic UUIDs

Idea standing behind this document is to provide a list of generic UUIDs which manufacturers assign to their iBeacons. There are many companies out there which are making iBeacons - some of them are recognizable brands and other are just small local companies. It doesn't matter - what matters here is to have a list of as many brands here as possible.

Why would anyone need generic UUIDs?

Imagine simple scenario: You're a developer of a mobile applications and you're not creating an app for a specific company, just a generic application which will be compatible with all iBeacos available to the end user.
With this document you can simply take those manufacturers UUIDs and use them in your app.
Of course, some providers may customize their beacons so they have modified UUIDs but this is the security/privacy thing and if you're developing an app for all iBeacons you probably won't care about them (but if you know any, feel free to enter it in this doc).

#!/bin/sh
PLIST_BUDDY=/usr/libexec/PlistBuddy
function add_compatibility() {
"$PLIST_BUDDY" -c "Add DVTPlugInCompatibilityUUIDs:10 string $2" \
"$1/Contents/Info.plist"
}
function has_compatibility() {