Skip to content

Instantly share code, notes, and snippets.

@xocialize
xocialize / .sh
Created April 10, 2019 18:15
default setup for new os x installation
#!/bin/sh
#Run this script after imaging a machine, this can run as a first run script (at REBOOT), but needs no parameters set if used from the Casper Suite
# Determine OS version
osvers=$(sw_vers -productVersion | awk -F. '{print $2}')
sw_vers=$(sw_vers -productVersion)
# Determine OS build number
sw_build=$(sw_vers -buildVersion)
LOCATION="${BUILT_PRODUCTS_DIR}"/"${FRAMEWORKS_FOLDER_PATH}"
# By default, use the configured code signing identity for the project/target
#IDENTITY="${CODE_SIGN_IDENTITY}"
IDENTITY="${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
if [ "$IDENTITY" == "" ]
then
# If a code signing identity is not specified, use ad hoc signing
IDENTITY="-"
fi
@xocialize
xocialize / gist:7f5d8b119bf143e1cdc83f217a0bf90b
Created March 15, 2019 21:21
Output from Sparkle Make Release
Merus-Mac-mini:Sparkle-ui-separation-and-xpc meru$ make release
xcodebuild -scheme Distribution -configuration Release -derivedDataPath "/var/folders/7q/2cq4mfm560g0cynz6t84zm1m0000gn/T//Sparkle.P2NhnD" build
User defaults from command line:
IDEDerivedDataPathOverride = /var/folders/7q/2cq4mfm560g0cynz6t84zm1m0000gn/T/Sparkle.P2NhnD
note: Using new build system
note: Planning build
note: Constructing build description
Build system information
warning: SparkleDownloader isn't code signed but requires entitlements. It is not possible to add entitlements to a binary without signing it. (in target 'SparkleDownloader')
@xocialize
xocialize / fontslist.swift
Created January 18, 2019 23:44
List Mac OS fonts
let fontFamilies = NSFontManager.shared.availableFontFamilies
for (index, family) in fontFamilies.enumerated() {
print("\(index). \(family)")
}
let fonts = NSFontManager.shared.availableFonts
for (index, font) in fonts.enumerated() {
print("\(index). \(font)")
}
@xocialize
xocialize / mac os hardware device id
Created January 16, 2019 23:02
Hardware ID mac os
//http://www.markcornelisse.nl/cocoa/cocoa-hardware-identifier-inside-os-x/
import Foundation
import IOKit
public var hardwareUUID: NSUUID = {
var hwUUIDBytes: [UInt8] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
var ts = timespec(tv_sec: 0,tv_nsec: 0)
gethostuuid(&hwUUIDBytes, &ts)
return NSUUID(UUIDBytes: hwUUIDBytes)
}()
@xocialize
xocialize / vfl.swift
Created January 10, 2019 00:29
VFL Centering
// Center horizontally
var constraints = NSLayoutConstraint.constraintsWithVisualFormat(
"V:[superview]-(<=1)-[label]",
options: NSLayoutFormatOptions.AlignAllCenterX,
metrics: nil,
views: ["superview":view, "label":label])
view.addConstraints(constraints)
// Center vertically
Quit Xcode.
Open Terminal.
Typed Command xattr -rc /Users/manabkumarmal/Desktop/Projects/MyProjectHome
Open Xcode.
Cleaned.
Now worked and No Error.
@xocialize
xocialize / Create iOS Icons 2017 Sizes.jsx
Created October 25, 2017 21:51 — forked from alexsdesign/Create iOS Icons 2016 Sizes.jsx
Photoshop Script to Create iOS Icons from a source image
// JavaScript Document
// Photoshop Script to Create iPhone Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale
@xocialize
xocialize / Tutorial.md
Created October 17, 2017 17:47 — forked from RF-Nelson/Tutorial.md
Using the Multipeer Connectivity Framework to Create the Open Source Selfie Stick iOS App

Using the iOS Multipeer Connectivity Framework to Create Open Source Selfie Stick

In this gist, I will discuss how I used the Multipeer Connectivity framework to create Open Source Selfie Stick. Open Source Selfie Stick is a free open-source iOS app that allows users to sync two devices over WiFi or Bluetooth and allows one to act as a remote control for the other's camera.

This tutorial assumes some knowledge of the Swift programming language and iOS development with Xcode.

Feel free to comment and point out any errors or improvements. If you'd like to help improve the app itself, make a fork from dev branch of the git repo. I plan on updating this document and explaining any newly added features or refactoring. As this gist w

@xocialize
xocialize / cloudkit-server.php
Created December 10, 2016 02:10 — forked from NSURLSession0/cloudkit-server.php
CloudKit server-to-server in PHP
<?php
// Constants
$KEY_ID = 'YOUR_KEY_ID';
$CONTAINER = 'YOUR_CONTAINER';
$PRIVATE_PEM_LOCATION = 'eckey.pem'; // Store this file outside the public folder!
// Config
$url = 'https://api.apple-cloudkit.com/database/1/' . $CONTAINER . '/development/public/records/query';
$body = '{"query":{"recordType":"Articles"}}';