Skip to content

Instantly share code, notes, and snippets.

View ddeville's full-sized avatar
🐈

Damien Deville ddeville

🐈
View GitHub Profile

Keybase proof

I hereby claim:

  • I am ddeville on github.
  • I am ddeville (https://keybase.io/ddeville) on keybase.
  • I have a public key ASDmES-E7HI6XQtpt82tRK2_gSj34to_05USfnddUUlorwo

To claim this, I am signing this object:

@ddeville
ddeville / gist:f9e78799cd5247f6dbfb
Created July 19, 2014 09:48
Find all tracks that match a given bit rate in iTunes and create a new playlist containing them
set track_bpm to 270
set playlist_name to "My Playlist"
tell application "iTunes"
set retrieved_tracks to get tracks where bit rate is track_bpm
set created_playlist to make new user playlist with properties {name:playlist_name}
repeat with current_track in retrieved_tracks
duplicate current_track to created_playlist
end repeat
@ddeville
ddeville / gist:b4db80697605474114bb
Created July 16, 2014 23:28
Create a bookmark in Spillo for every tab in the current Safari window
tell application "Safari"
set current_tabs to tabs of front window
repeat with current_tab in current_tabs
set tab_title to name of current_tab
set tab_address to URL of current_tab
tell application "Spillo"
make new bookmark with properties {url:tab_address, title:tab_title}
end tell
@ddeville
ddeville / gist:118a4eb1b52483228383
Created July 12, 2014 21:50
Create a new bookmark in Spillo with the content from the frontmost tab in Safari
tell application "Safari"
set current_tab to current tab of front window
set tab_title to name of current_tab
set tab_address to URL of current_tab
tell application "Spillo"
make new bookmark with properties {url:tab_address, title:tab_title}
end tell
end tell
@ddeville
ddeville / gist:dc6ba4346604ab4d6b65
Created July 12, 2014 21:49
Present the bookmark creation window in Spillo and populate it with the content from the frontmost tab in Safari
tell application "Safari"
set current_tab to current tab of front window
set tab_title to name of current_tab
set tab_address to URL of current_tab
tell application "Spillo"
show create bookmark panel with properties {url:tab_address, title:tab_title}
end tell
end tell
@ddeville
ddeville / gist:90f341f6ed7c592900ab
Last active August 29, 2015 14:01
Get the actual home directory when running in the OS X sandbox
#import <unistd.h>
#import <pwd.h>
NSURL *_LLActualHomeDirectoryLocation(void) {
static NSURL *homeDirectoryLocation = nil;
static dispatch_once_t homeDirectoryLocationPredicate = 0;
dispatch_once(&homeDirectoryLocationPredicate, ^ {
uid_t uid = getuid();
@ddeville
ddeville / Salinger list of works
Created March 14, 2014 08:58
Salinger list of works
The Young Folks (1940)
Go See Eddie (1940)
The Hang of It (1941)
The Heart of a Broken Story (1941)
The Long Debut of Lois Taggett (1942)
Personal Notes of an Infantryman (1942)
Mrs. Hincher (Unpublished) (1942)
The Last and Best of the Peter Pans (Unpublished) (1942)
The Varioni Brothers (1943)
Both Parties Concerned (1944)
@ddeville
ddeville / gist:7173457
Created October 26, 2013 19:19
NSArrayController and +keyPathsForValuesAffectingValueForKey:
//
// main.m
// KVO
//
// Created by Damien DeVille on 10/26/13.
// Copyright (c) 2013 Damien DeVille. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@ddeville
ddeville / gist:7169443
Last active December 26, 2015 14:59
+keyPathsForValuesAffectingValueForKey: vs +keyPathsForValuesAffecting<Key>.
//
// main.m
// KVO
//
// Created by Damien DeVille on 10/26/13.
// Copyright (c) 2013 Damien DeVille. All rights reserved.
//
#import <Foundation/Foundation.h>
@ddeville
ddeville / gist:7103822
Created October 22, 2013 16:32
Think of a parent view controller that contains two children view controllers. The title of the parent view controller is a mixture of the titles of its children. The title of the second view controller depends on the name of its represented object too. Now, one would only need to bind the title of the window (for example) to the parent view con…
@interface ParentViewController : NSViewController
@property (strong, nonatomic) FirstChildViewController *firstViewController;
@property (strong, nonatomic) SecondChildViewController *secondViewController;
@end
@implementation ParentViewController