Skip to content

Instantly share code, notes, and snippets.

@dinge
dinge / gist:6983008
Created October 14, 2013 22:05
calling applescript from ruby
def osascript(script)
system 'osascript', *script.split(/\n/).map { |line| ['-e', line] }.flatten
end
osascript <<-END
tell application "Finder"
display dialog "Hello"
end tell
END
@dinge
dinge / sanitizer.rb
Created July 4, 2012 12:50
DocUtils::Sanitizer
class DocUtils::Sanitizer
@sanitizer = HTML::WhiteListSanitizer.new
AllowedTags = {
:none => [],
:default => %w(u img a i b div br ul li),
:only_images => %w(img)
}
/**
* This code is property of Apple Inc.
* This code is intended for informational use only.
* Apple has granted no license for distribution or use.
**/
var controller = {};
controller.showInterface = function() {
if (1 == dataController.showVersionNumber) {
controller.setUpCacheLogging()
/**
* This code is property of Apple Inc.
* This code is intended for informational use only.
* Apple has granted no license for distribution or use.
**/
const iPad = true;
const ADSupportsTouches = ("createTouch" in document);
const ADStartEvent = ADSupportsTouches ? "touchstart": "mousedown";
const ADMoveEvent = ADSupportsTouches ? "touchmove": "mousemove";
/**
* This code is property of Apple Inc.
* This code is intended for informational use only.
* Apple has granted no license for distribution or use.
**/
var controller = {};
controller.showInterface = function() {
if (1 == dataController.showVersionNumber) {
controller.setUpCacheLogging()
/**
* This code is property of Apple Inc.
* This code is intended for informational use only.
* Apple has granted no license for distribution or use.
**/
const iPad = true;
const ADSupportsTouches = ("createTouch" in document);
const ADStartEvent = ADSupportsTouches ? "touchstart": "mousedown";
const ADMoveEvent = ADSupportsTouches ? "touchmove": "mousemove";
/**
* This code is property of Apple Inc.
* This code is intended for informational use only.
* Apple has granted no license for distribution or use.
**/
const iPad = true;
const ADSupportsTouches = ("createTouch" in document);
const ADStartEvent = ADSupportsTouches ? "touchstart": "mousedown";
const ADMoveEvent = ADSupportsTouches ? "touchmove": "mousemove";
/**
* This code is property of Apple Inc.
* This code is intended for informational use only.
* Apple has granted no license for distribution or use.
**/
var controller = {};
controller.showInterface = function() {
if (1 == dataController.showVersionNumber) {
controller.setUpCacheLogging()
$LOAD_PATH << './lib'
require "lib/neo4j"
require "rubygems"
require "ruby-debug"
class Person
include Neo4j::NodeMixin
# define Neo4j properties
property :name
#who is in love?
architect.traverse.both(:friends, :has_coded, :loves).depth(:all).filter do
outgoing(:loves).to_a.size > 0
end.each do |n|
puts n.name
end