Skip to content

Instantly share code, notes, and snippets.

View rubyist's full-sized avatar

Scott Barron rubyist

View GitHub Profile
require 'rubygems'
require 'growl_glue'
GrowlGlue::Autotest.initialize do |config|
config.title :success => 'YOU ROCK'
config.title :failure => 'YOU SUCK'
config.sound :success => 'tpir-dings.wav'
config.sound :failure => 'tpirhorns.wav'
config.sound :location => '/Users/scott'
end
Index: app/src/processing/app/Preferences.java
===================================================================
--- app/src/processing/app/Preferences.java (revision 5415)
+++ app/src/processing/app/Preferences.java (working copy)
@@ -154,9 +154,13 @@
// start by loading the defaults, in case something
// important was deleted from the user prefs
try {
- load(Base.getLibStream("preferences.txt"));
+ if (commandLinePrefs != null) {
;; My conventions for Cocoa are Foo.h - but the auto-mode-alist
;; searches with sensitivity based on case-fold-search, this function
;; will check for that and set Foo.h to objc-mode while keeping foo.h
;; in c-mode.
(defun determine-header-objc-ness ()
(let (sensitivity)
(setq sensitivity case-fold-search)
(setq case-fold-search nil)
(if (string-match "^[A-Z].*\\.h$" (buffer-name))
(objc-mode)
(defun butterfly ()
"Use butterflies to flip the desired bit on the drive platter.
Open hands and let the delicate wings flap once. The disturbance
ripples outward, changing the flow of the eddy currents in the
upper atmosphere. These cause momentary pockets of higher-pressure
air to form, which act as lenses that deflect incoming cosmic rays,
focusing them to strike the drive platter and flip the desired bit.
You can type `M-x butterfly C-M-c' to run it. This is a permuted
variation of `C-x M-c M-butterfly' from url `http://xkcd.com/378/'."
(interactive)
on opening folder this_folder
tell application "Safari"
activate
tell application "System Events"
tell process "Safari"
click menu item "New Tab" of menu "File" of menu bar 1
end tell
end tell
set the URL of document 1 to "file:///Users/foo/bar.html"
end tell
# spec -cfs user_spec.rb
require 'rubygems'
require 'aasm'
require 'active_record'
require 'fileutils'
FileUtils.rm_f('dbfile')
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => "dbfile")
ActiveRecord::Schema.create_table(:users) do |t|
t.string :name
on opening folder this_folder
tell application "Safari"
activate
tell application "System Events"
tell process "Safari"
click menu item "New Tab" of menu "File" of menu bar 1
end tell
end tell
set the URL of document 1 to "file:///Users/scott/Books/Foo/index.html"
end tell
(defun rename-file-and-buffer (new-name)
(interactive "sNew Name: ")
(write-file (buffer-file-name))
(setq new-file-path (concat (file-name-directory (buffer-file-name)) new-name))
(if vc-mode
(vc-rename-file (buffer-file-name) new-file-path)
(rename-file (buffer-file-name) new-file-path))
(set-visited-file-name new-file-path nil 1))
alias iphone="open /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app"
tell application "System Events"
tell current location of network preferences
set VPNservice to service "Name of VPN"
if exists VPNservice then disconnect VPNservice
end tell
end tell