Skip to content

Instantly share code, notes, and snippets.

@palimondo
palimondo / gist:5998280
Last active December 19, 2015 18:19
Concise Auto Layout macros
#define Left NSLayoutAttributeLeft
#define Right NSLayoutAttributeRight
#define Top NSLayoutAttributeTop
#define Bottom NSLayoutAttributeBottom
#define Leading NSLayoutAttributeLeading
#define Trailing NSLayoutAttributeTrailing
#define Width NSLayoutAttributeWidth
#define Height NSLayoutAttributeHeight
#define CenterX NSLayoutAttributeCenterX
#define CenterY NSLayoutAttributeCenterY
@chrisphenry
chrisphenry / Main.css
Created February 12, 2014 03:28
Safari 7 - Customise Web Inspector font
/*Customise Safari Web Inspector font*/
/*(tested on Safari 7.0.1 on OS X Mavericks)*/
/*NO WARRANTY IMPLIED - Will work until Safari is updated requiring a re-patch*/
/*INSTRUCTIONS*/
1. Quit Safari
2. In Finder go to the following folder: /System/Library/PrivateFrameworks
3. Copy the following framework to your Desktop: WebInspectorUI.framework
4. Rename the original framework to avoid overwriting - I append .orig to the filename - authenticate if necessary
5. Open Terminal and enter the following command: chmod 777 ~/Desktop/WebInspectorUI.framework/Versions/A/Resources/Main.css
func p_setupTextLayer(text: String) -> CAShapeLayer {
var letters = CGPathCreateMutable()
let font = CTFontCreateWithName("Helvetica-Bold", 72, nil)
let attrs = [kCTFontAttributeName: font]
var attrString = NSAttributedString(string: text, attributes: attrs)
let line = CTLineCreateWithAttributedString(attrString)
let runArray = CTLineGetGlyphRuns(line)
@lukaskollmer
lukaskollmer / hack.m
Created June 21, 2016 15:30
UITextView: Allow tapping links from NSAttributedString, but disallow text selection
/**
Note to self:
This UITextView class extension gets calles every time iOS wants to add a new gesture recognizer to the textView.
It checks for the type of the gesture recognizer (Long Press) and then for the associated action.
Only if the action is ``smallDelayRecognizer:``, the gestuere recognizer will stay enabled.
All otheer long press gestures will be disabled.
Purpose:
Allow user interaction with the links in the attributedText, but disallow text selection
在hass中用Google Home语音控制小米扫地机器人

試してみたいCocoa API

iCloud関連

Event Kit

ブロック使うAPIだった。

Core Location

@mindmergedesign
mindmergedesign / st3_sync
Created February 14, 2014 18:33
Sync Sublime Text 3 Packages and Settings with Dropbox
####################
# FROM MAIN COMPUTER
####################
# Create the sync directory in Dropbox
$ mkdir ~/Dropbox/sublime-text-3
# Move your ST3 "Packages" and "Installed Packages" to Dropbox
$ cd ~/Library/Application\ Support/Sublime\ Text\ 3
$ mv Packages/ ~/Dropbox/sublime-text-3
$ mv Installed\ Packages/ ~/Dropbox/sublime-text-3
@kylefiedler
kylefiedler / css.snippets
Last active November 7, 2019 16:42
Vim CSS Snippets
#Sass Snippets
snippet @i
@import "${1}";
snippet ext
@extend ${1};
snippet inc
@include ${1}(${2});${3}
snippet @m
@media ${1} {
${2}
@lmullen
lmullen / .slate
Created February 8, 2013 04:19
My configuration file for the Slate window manager
# GLOBAL CONFIGURATIONS
# -------------------------------------------------------------------
# See https://github.com/jigish/slate/wiki/Global-Configs
config defaultToCurrentScreen true
config secondsBeforeRepeat 0.4
config secondsBetweenRepeat 0.1
config keyboardLayout "qwerty"
config nudgePercentOf screenSize
config resizePercentOf screenSize
@Tokuriku
Tokuriku / universal-framework.sh
Last active September 2, 2020 10:59 — forked from cromandini/universal-framework.sh
Script to put in an Aggregate Target of a Framework in Xcode 6 to create a Universal Framework
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build