Skip to content

Instantly share code, notes, and snippets.

@artgon
artgon / gist:1361497
Created November 13, 2011 02:27
Post previews for Github Pages (a la wordpress)
{% for post in site.posts limit:5 %}
<div class="box">
<h3>{{post.title}}</h3>
<div class="clearfix"></div>
<div class="right big">
{% assign breakIndex = -1 %}
{% for element in post.content %}
{% if element contains '<!--more-->' %}
{% assign breakIndex = forloop.index %}
{% endif %}
@Andrewpk
Andrewpk / OSX-junos_pulse_listenToMe.sh
Last active April 16, 2022 03:01
wtf juniper. Anyone else find it irritating that junos pulse services and pulse tray must always running in OS X regardless of whether or not you're currently connected? Yeah, me too. I added the following as aliases to my shell to fix this problem. Be sure to change your /Library/LaunchAgents/net.juniper.pulsetray.plist file to reflect the `Kee…
#################################################################################
# start and stop the vpn from the command line from now on with these two commands
# or rename the aliases as you see fit.
#################################################################################
alias startvpn="sudo launchctl load -w /Library/LaunchDaemons/net.juniper.AccessService.plist; open -a '/Applications/Junos Pulse.app/Contents/Plugins/JamUI/PulseTray.app/Contents/MacOS/PulseTray'"
alias quitvpn="osascript -e 'tell application \"PulseTray.app\" to quit';sudo launchctl unload -w /Library/LaunchDaemons/net.juniper.AccessService.plist"
As of iOS 11/macOS High Sierra, and only including ones in Foundation and CoreFoundation
Strings:
_NSCFString - a CFStringRef or CFMutableStringRef. This is the most common type of string object currently.
- May have 8 bit (ASCII) or 16 bit (UTF-16) backing store
_NSCFConstantString - a compile time constant CFStringRef, like you'd get with @"foo"
- May also be generated by dynamic string creation if matches a string in a pre-baked table of common strings called the StringROM
NSBigMutableString - an NSString backed by a CFStorage (https://github.com/opensource-apple/CF/blob/master/CFStorage.h) for faster handling of very large strings
NSCheapMutableString - a very limited NSMutableString that allows for zero-copy initialization. Used in NSFileManager for temporarily wrapping stack buffers.
@keithnorm
keithnorm / UICollectionView+ScrollViewAnimateable.swift
Created May 25, 2016 14:45
enable animating a scroll view's contentOffset property with custom easing
//
// UICollectionView+ScrollViewAnimateable.swift
// persimmon
//
// Created by Keith Norman on 5/24/16.
// Copyright © 2016 Good Eggs. All rights reserved.
//
/// Based on https://github.com/plancalculus/MOScrollView. This allows animating contentOffset with a timing function. It's not possible to animate contentOffset via a CAAnimation. It is possible to animate bounds but then scrollview delegate methods don't get called which may be an issue if the animation exposes new cells in a table view or collection view and you expect those cells to render when the scroll into view.
@jcs
jcs / gist:5573685
Last active October 20, 2023 18:21
macOS FileVault encryption and OpenBSD encrypted softraid on a Macbook Air/Pro

Update (2019-05-06): The Broadcom wireless card in the MacBook Pro works and can be crammed into the Air.

Update (2015-12-04): This document used to be very lengthy as there were many manual steps required to get OpenBSD and Mac OS X working together through Boot Camp Assistant (BCA), which created a hybrid MBR and enabled a legacy BIOS emulation mode which older versions of Windows (and OpenBSD) required. Newer Macbooks stopped supporting older versions of Windows through BCA and now only support Windows 10 since it uses GPT and UEFI. However, now that newer versions of OpenBSD support GPT and UEFI, Boot Camp Assistant is no longer needed at all to boot OpenBSD.

macOS FileVault encryption and OpenBSD encrypted softraid on a Macbook Air/Pro

OpenBSD works pretty well on at least the Mid-2011 Macbook Air (A1370, SandyBridge) and Mid-2013 Macbook Air (Haswell). The new KMS code in 5.4 brings up the MBA's eDP display in 1366x768 with backlight

@mattt
mattt / uiappearance-selector.md
Last active March 19, 2024 12:52
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \