Skip to content

Instantly share code, notes, and snippets.

View peterprokop's full-sized avatar

Peter Prokop peterprokop

View GitHub Profile
<!DOCTYPE html>
<html>
<script type="text/javascript">
//<![CDATA[
function randomArray(length, max) {
return Array.apply(null, Array(length)).map(function() {
return Math.round(Math.random() * max);
});
}
* iOS
`~/Library/Developer/CoreSimulator/Devices` - iOS simulators folder
`instruments -s devices` - list all runnable devices/simulators
`Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport` - device support dir
* GIT
`git submodule update --init --recursive` - grab submodules
`git branch --sort=-committerdate | tail -n 50 | xargs git branch -d` delete 50 oldest branches
`git checkout -t <name of remote>/test` - checkout remote branch
for i in *.* ; do mv "$i" "_$i" ; done
for family in UIFont.familyNames {
print("\(family)")
for name in UIFont.fontNames(forFamilyName: family) {
print(" - \(name)")
}
}
@peterprokop
peterprokop / gist:b970f72ee50e899fccd826a691c3a23a
Created January 12, 2017 15:52
Remove local tags, fetch from remote
git tag -l | xargs git tag -d
git fetch --tags
@peterprokop
peterprokop / upload-to-appstore.sh
Created December 8, 2016 09:16 — forked from jedi4ever/upload-to-appstore.sh
Command upload App/Ipa to the iTunes Connect App Store
#!/bin/bash
set -ex
# This scripts allows you to upload a binary to the iTunes Connect Store and do it for a specific app_id
# Because when you have multiple apps in status for download, xcodebuild upload will complain that multiple apps are in wait status
# Requires application loader to be installed
# See https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html
# Itunes Connect username & password
USER=bla
@peterprokop
peterprokop / URLRequest.swift
Last active August 29, 2022 15:40
Print NSURLRequest in cURL format (Swift 3)
//
// URLRequest.swift
//
// Created by Peter Prokop on 17/08/2017.
import Foundation
public extension URLRequest {
/// Returns a cURL command for a request
@peterprokop
peterprokop / DefaultsManager.swift
Created January 6, 2016 07:56
A simple wrapper for NSUserDefaults
class DefaultsManager {
enum Key : String {
case
AuthToken = "AuthToken",
AuthTokenTimestamp = "AuthTokenTimestamp"
}
class var sharedInstance : DefaultsManager {
struct Static {
static let instance : DefaultsManager = DefaultsManager()
@peterprokop
peterprokop / sum.asm
Created September 13, 2015 14:22
Fooling around with nasm
; /usr/local/bin/nasm -f macho64 sum.asm && ld -macosx_version_min 10.7.0 -lSystem -o sum sum.o && ./sum
global start
section .text
extern _printf
extern _exit
start: