Skip to content

Instantly share code, notes, and snippets.

View drnic's full-sized avatar
🏆
Platinum Status Level

Dr Nic Williams drnic

🏆
Platinum Status Level
View GitHub Profile
// FROM: http://svn.cocoasourcecode.com/SkinnableApp/AppController.m
//
// AppController.m
// SkinnableApp
//
// Created by Matt Gemmell on 24/02/2008.
// Copyright 2008 Magic Aubergine. All rights reserved.
//
#import "AppController.h"
# Image well
def addImage(sender)
return unless recipe = recipeArrayController.selectedObjects.lastObject
p recipe # => #<NSManagedObject_Recipe_:0x800525ee0>
openPanel = NSOpenPanel.openPanel
openPanel.canChooseDirectories = false
openPanel.canCreateDirectories = false
openPanel.allowsMultipleSelection = false
@drnic
drnic / open_file_selector_and_process.rb
Created December 31, 2008 03:10
The recipe object starts as an NSManagedObject for Recipe entity, but then becomes a Pointer without setValue:forKey: support
# Image well
def addImage(sender)
return unless recipe = recipeArrayController.selectedObjects.lastObject
p recipe # => #<NSManagedObject_Recipe_:0x800525ee0>
openPanel = NSOpenPanel.openPanel
openPanel.canChooseDirectories = false
openPanel.canCreateDirectories = false
openPanel.allowsMultipleSelection = false
# Returns the persistent store coordinator for the application. This
# implementation will create and return a coordinator, having added the
# store for the application to it. (The folder for the store is created,
# if necessary.)
def persistentStoreCoordinator
if @persistentStoreCoordinator
return @persistentStoreCoordinator
end
error = Pointer.new_with_type('@')
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_deleted {
[[ $(git status 2> /dev/null | grep deleted:) != "" ]] && echo "-"
}
function parse_git_added {
[[ $(git status 2> /dev/null | grep "Untracked files:") != "" ]] && echo '+'
module ChocTop::Appcast
def make_build
sh "xcodebuild -configuration Release"
end
def make_dmg
FileUtils.rm_rf pkg
sh "hdiutil create -volname '#{name}' -srcfolder 'build/Release/#{target}' '#{pkg}'"
end
/*
Copyright (C) 2007 Stig Brautaset. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
var list = $$('ul.entry-list li');
for (var i = 0; i < list.length; i++) {
var li = list[i];
if (!(li.innerHTML.match(/Available for hire/))) {
li.parentNode.removeChild(li);
}
}
@drnic
drnic / mocha.rb
Created March 17, 2009 13:47
For mocha integration into Cucumber, add this file into features/support folder
# For mocha integration, add this file into features/support folder
require "mocha"
World(Mocha::Standalone)
Before do
mocha_setup
end
def advertise!
puts "* Advertising on bonjour"
tr = DNSSD::TextRecord.new
tr["uri"] = web_uri
tr["name"] = Bananajour.config.name
DNSSD.register("#{config.name}'s bananajour", "_bananajour._tcp", nil, web_port, tr) {}
end