Skip to content

Instantly share code, notes, and snippets.

@hishma
hishma / ViewAperturePhotoOnFlickr.applescript
Created July 13, 2011 15:16
View an Aperture photo on flickr
-- View an Aperture photo on flickr
-- Assumes a custom metadata field in Aperture named "Flickr URL" exists.
tell application "Aperture"
-- selection always returns image versions
set selectedImages to (get selection)
if (count of items in selectedImages) > 0 then
repeat with i from 1 to count of selectedImages
tell library 1
set img to item i of selectedImages
@hishma
hishma / setTitleToVersionName.applescript
Created July 13, 2011 15:24
Copy the Aperture Version Name to the IPTC ObjectName (Title field in Aperture)
-- Copy the Aperture Version Name to the IPTC ObjectName (Title field in Aperture)
tell application "Aperture"
set selectedImages to (get selection)
if selectedImages is {} then
error "Please select an image."
else
repeat with i from 1 to count of selectedImages
tell library 1
tell item i of selectedImages
@hishma
hishma / random word
Created October 27, 2011 16:55
Copy a random word to the clipboard
sed `perl -e "print $RANDOM"`"q;d" /usr/share/dict/words | tr -d '\n' | pbcopy
@hishma
hishma / just_another_afternoon_spec.rb
Created July 31, 2012 23:53
just another afternoon spec
describe "just another afternoon” do
jeff = Factory.create(:loser)
artie = Cat.new(:name => "Artie", :size => "long", :color => "black”)
helpeless_victim = Victim.new(:type => ['Mouse, 'Bird', 'Mole', 'Rat'].sample)
artie.catch(helpless_victim)
while helpeless_victim.is_alive?
artie.torture(victim)
sleep 10
@hishma
hishma / smoked_salmon_chowder.md
Last active November 16, 2020 21:01
Smoked Salmon Chowder Recipe

Smoke Salmon Chowder

Bone warming goodness on a cold rainy day.

Ingredients

  • Smoked Salmon (a typical store package seems to work fine)
  • Small container heavy cream
  • Handful of nice small potatoes (red new, yukon gold, whatev)
  • Couple of standard issue carrots
@hishma
hishma / 256-char
Created April 8, 2014 16:39
256 Character String
THIS STRING IS 256 CHARACTERS xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@hishma
hishma / fix-xcode-docs.md
Last active October 10, 2022 16:10
HowTo Fix Xcode Documentation

Fix for missing documentation indexes and other anomolies in the Xcode documentation viewer. Mine seemed to get all borked up with some beta relaeases. Shamelessly ripped off from this thread.

  1. Quit Xcode
  2. Delete the cache file at ~/Library/Caches/com.apple.dt.Xcode.
  3. Delete the contents of ~/Library/Developer/Shared/Documentation/DocSets/.
  4. Delete the contents of /Applications/Xcode.app/Contents/Developer/Documentation/DocSets/.
  5. Launch Xcode.
  6. Open the Preferences pane, select the Downloads tab, and download the docsets you want to use.
@hishma
hishma / versionInSettings.md
Last active May 31, 2022 07:26
Display iOS app version in settings

To display the current version of an iOS app in the settings

  1. Add an entry like this in Settings.bundle/Root.plist
<key>PreferenceSpecifiers</key>
<array>
  <dict>
    <key>Type</key>
 PSTitleValueSpecifier
@hishma
hishma / logPretty.swift
Created December 17, 2015 00:08
Debug like a caveman in swift
func logPretty(message: String? = nil, file: String = __FILE__, line: UInt = __LINE__, function: StaticString = __FUNCTION__) {
var pretty = "\((file as NSString).lastPathComponent)(\(line)) : \(function)"
if let message = message where !message.isEmpty {
pretty += " ☞ \(message)"
}
print(pretty)
}
@hishma
hishma / NSPersonNameComponents.swift
Created May 5, 2016 14:02
Swift extension to NSPersonNameComponents for Prince & friends.
//
// NSPersonNameComponents.swift
//
import Foundation
extension NSPersonNameComponents {
// Because the web is generally xenophobic…
var xenophobicName: (firstName: String, lastName: String)? {