Skip to content

Instantly share code, notes, and snippets.

View seandenigris's full-sized avatar

Sean DeNigris seandenigris

View GitHub Profile
@seandenigris
seandenigris / gist:950198
Created May 1, 2011 02:43
Get the bundle identifier for a Mac application
#!/usr/local/bin/macruby
applicationPath = '/Applications/Mail.app'
p NSBundle.bundleWithPath(applicationPath).bundleIdentifier
@seandenigris
seandenigris / gist:980808
Created May 19, 2011 13:59
MacRuby Wrapper for NSWorkspace Mount Notifications
class MountNotification
def initialize(anNSNotification)
@nsNotification = anNSNotification
end
def name()
'NSWorkspaceDidMountNotification'
end
def workspace()
@seandenigris
seandenigris / gist:980897
Created May 19, 2011 14:42
MacRuby Wrapper for NSWorkspace Wake Notifications
class WakeNotification
def initialize(anNSNotification)
@nsNotification = anNSNotification
end
def name()
'NSWorkspaceDidWakeNotification'
end
def workspace()
@seandenigris
seandenigris / gist:1062303
Created July 3, 2011 15:08
Identify hidden characters in a file
Transcript cr; cr; cr.
FileStream readOnlyFileNamed: '/path/to/file.ext' do: [ :f | | c |
[f atEnd] whileFalse: [
c := f next.
(({(33 to: 47). (58 to: 64). (91 to: 96).} anySatisfy: [ :range | range includes: c asciiValue ]) or: [ c asciiValue > 126 ])
ifTrue: [
Transcript
show: 'At ', f position asString; tab;
show: 'Character ', c asString; tab;
show: 'Code ', c asciiValue asString; cr] ]].
@seandenigris
seandenigris / gist:1142556
Created August 12, 2011 17:48
Pharo Smalltalk: Remove all XMLRPC services
XMLRPCServerRequest classVarNamed: #Receivers keysDo: [ :s | XMLRPCServerRequest removeService: s ]
@seandenigris
seandenigris / gist:1149034
Created August 16, 2011 13:09
Applescript to "Make new C++ Project"
to make_new_project(project_name)
tell application "Xcode" to activate
tell application "System Events"
tell process "Xcode"
click menu item "New Project…" of menu 1 of menu bar item "File" of menu bar 1
tell window "New Project"
-- row 8 is empty project, 4 is Cocoa App
select row 4 of outline 1 of scroll area 1 of splitter group 1 of group 1
click button "Cocoa Application" of radio group 1 of scroll area 1 of splitter group 1 of splitter group 1 of group 1
@seandenigris
seandenigris / gist:1162273
Created August 22, 2011 12:28
Log onto ESUG 2010 Wireless
activate application "Captive Network Assistant"
tell application "System Events"
tell process "Captive Network Assistant"
tell UI element 1 of scroll area 1 of window "Join “central”"
set value of text field 1 of group 12 to ""
set value of text field 1 of group 14 to ""
click button "Submit" of group 16
end tell
end tell
end tell
@seandenigris
seandenigris / gist:1162413
Created August 22, 2011 13:51
Set up Pharo image to build Cog VM
"Place Pharo 1.3 or 1.4 image, changes, and sources in build directory of cog vm sources. Then doit:"
Gofer new
squeaksource: 'MetacelloRepository';
package: 'ConfigurationOfCog';
load.
(Smalltalk at: #ConfigurationOfCog) project lastVersion load.
"Pick a VM e.g. CogMacOSConfig or StackCocoaIOSConfig"
@seandenigris
seandenigris / README
Created November 8, 2011 05:20 — forked from jamie/README
Get around vimeo's stupid daily download limit restrictions
Usage:
./vimeo.rb video-id [password] [output filename, no extension]
Known issues:
I should put some better arg handling in, if you download a video w/ password it will use the password as output filename.
@seandenigris
seandenigris / gist:1387590
Created November 23, 2011 00:47
Pharo Smalltalk: Move extension methods into different package
oldPackageName := 'LivingCode-bdd extensions'.
newPackageName := 'BDDExtensions'.
package := PackageInfo named: oldPackageName.
extendedClasses := package extensionMethods collect: [ :e | e methodClass ] as: Set.
extendedClasses do: [ :c | c organization renameCategory: '*', oldPackageName toBe: '*', newPackageName ].