Skip to content

Instantly share code, notes, and snippets.

@rxwei
rxwei / ad-manifesto.md
Last active November 9, 2023 09:58
First-Class Automatic Differentiation in Swift: A Manifesto
@alessaba
alessaba / PlaygroundsFrameworks.swift
Last active July 29, 2023 21:47
List of available frameworks in Swift Playgrounds over the years
// Swift Playgrounds Beta 1.0
import AVFoundation
import AVKit
import Accelerate
import Accounts
import AudioToolbox
import AudioUnit
import CFNetwork
import CoreAudio
import CoreAudioKit
@mattt
mattt / bridge.swift
Last active June 14, 2023 11:47
Example usage of @mxcl's swift-sh
#!/usr/bin/swift sh
import DeckOfPlayingCards // @NSHipster ~> 4.0.0
import PlayingCard
import Cycle // @NSHipster == bb11e28
class Player {
var name: String
var hand: [PlayingCard] = []
@mluisbrown
mluisbrown / FixBTSound.applescript
Last active June 8, 2023 19:02
AppleScript to set macOS audio input device to "Internal Microphone"
-- Sets your audio input source to "Internal Microphone"
-- Frequently needed if you use bluetooth headpohones and
-- run the Xcode iOS simulator, which will often set your
-- headphones to be the input device, resulting in a drastic
-- decrease in sound quality, and making it mono
tell application "System Preferences" to activate
tell application "System Preferences"
reveal anchor "input" of pane id "com.apple.preference.sound"
end tell

Greetings, NSHipsters!

As we prepare to increment our NSDateComponents -year by 1, it's time once again for NSHipster end-of-the-year Reader Submissions! Last year, we got some mind-blowing tips and tricks. With the release of iOS 7 & Mavericks, and a year's worth of new developments in the Objective-C ecosystem, there should be a ton of new stuff to write up for this year.

Submit your favorite piece of Objective-C trivia, framework arcana, hidden Xcode feature, or anything else you think is cool, and you could have it featured in the year-end blowout article. Just comment on this gist below!

Here are a few examples of the kind of things I'd like to see:

  • Using NSStringFromSelector(@selector()) as a safer way to do KVC / KVO / NSCoding.
  • Panic's [rather surprising discovery about the internals of the Lightning Digital AV Adapter](http://www.panic.com/blog/the-lightning-di
@mbostock
mbostock / .block
Last active January 14, 2023 04:21
Screen Recording to GIF
license: gpl-3.0
@keith
keith / simctl-commands.txt
Last active December 7, 2022 23:27
All the subcommands of `xcrun simctl` (including ones that aren't listed in `simctl help`) LC_SOURCE_VERSION 776.1 (Xcode 13.0 beta 5)
addmedia
addphoto
addvideo
appinfo
boot
bootstatus
clone
create
darwinup
delete
@adamwiggins
adamwiggins / end-of-a-chapter.md
Last active November 24, 2022 11:40
End of a chapter: my Heroku departure message

It's with a heavy heart that I announce that Friday, May 31 2013 will be my last day at Heroku.

How can I possibly put into words what Heroku has meant to me these last six years? I can say it was a tremendous experience; or the opportunity of a lifetime; or the greatest thing I have ever been a part of. I can say that Heroku has been my life's work, as I did recently in a public blog post. All of those things are true, but none seem to capture the enormity of what's transpired these past six years.

I tend to focus on mechanical elements of a company: product, code, design, process. But what has surprised me the most at Heroku is that none of these things is the best part. The best part is the team.

I've never had the chance to work with a more singular group of people. Talented, passionate, skilled, dedicated. Most of all, sharing a set of values: elegance, craft, maniacal focus on simplicity; and an uncompromising belief that the future will be made of software, and how that software gets made will shape

@miikka
miikka / cheatsheet.rnc
Created January 12, 2016 19:54
RELAX NG compact syntax cheat sheet
# RELAX NG compact syntax cheat sheet
# See also:
# * tutorial <http://www.relaxng.org/compact-tutorial-20030326.html>
# * spec <http://www.relaxng.org/compact-20021121.html>
# Checking a XML file:
#
# jing -c schema.rnc file.xml
#
@kongtomorrow
kongtomorrow / gist:e95bea13162ca0e29d4b
Last active August 31, 2022 16:20
Y combinator in Swift!
/* The Y combinator in Swift!
For a discussion of what the heck this is all about, see http://www.ece.uc.edu/~franco/C511/html/Scheme/ycomb.html
The nifty thing is that it allows us to implement recursion without the ability for a function to refer to itself from within its own definition.
Note how we manage a recursive definition of factorial without any function referring to its own name.
Thanks to @eridius for help with the SelfToUnderlying<T> type.
*/