Skip to content

Instantly share code, notes, and snippets.

# See: http://growl.info/documentation/applescript-support.php
# This is still pretty much voodoo to me
#
# The name argument specifies the name that will appear in the "Applications"
# tab of the Growl preferences pane.
def RBGrowl(name, title, body, icon = 'Console')
name, title, body, icon = [name, title, body, icon].map { |v| v.inspect }
ascript = %{tell application "GrowlHelperApp"
-- Make a list of all the notification types that this script will ever send:
set the allNotificationsList to {#{name}}
#!/usr/bin/env ruby
# Save this to ~/bin/lns then never worry about the -s option and argument order
# for ln again
a,b = ARGV[0..1]
abort "provide source and dest, in any order" unless ARGV.size == 2
if File.exist?(a) && File.exist?(b)
abort "both files exist"
view.Person = function() {
var
root = $.n('div.person'),
api = {},
ins = {},
n = function() { return $.fn.n.apply(root, arguments) };
// draw the view with the given attributes
api.init = function(attribs) {
n('form').n(function(n) {
#!/usr/bin/env ruby
gems = File.read(ARGV[0] || 'app.rb').grep(/^gem/).map { |l| l.match(/gem\s+['"]([^'"]+?)['"],\s*['"]([^'"]+?)['"]/).captures }
gems_file = gems.map { |name,version| name + ' --version=' + version }.join("\n") + "\n"
File.open('.gems','w') { |f| f.write gems_file }
puts gems_file
// FancyDomBuilder:
$.fn.n = function(builder) {
var self = this;
builder(function(str) { return $(str).appendTo(self) });
return self;
};
// with FancyDomBuilder:
// FancyNodeBuilder
$ = (function(jquery) {
function jqueryWithFancyTagBuilder() {
if (arguments.length == 1 && isTagBuilderString(arguments[0]))
return jquery(compileTag(arguments[0]));
else
return jquery.apply(null, arguments);
}
:style
body.examples > .example_item
:margin-top 200px
.example_item
:margin-top 20px
:position relative
input
:position absolute
:right 0
myles:Desktop myles$ mkdir tmp
myles:Desktop myles$ cd tmp/
myles:tmp myles$ ls
myles:tmp myles$ ls
myles:tmp myles$ touch Server
myles:tmp myles$ touch Server2
myles:tmp myles$ touch foo
myles:tmp myles$ ls
Server Server2 foo
myles:tmp myles$ ls [!Server]*
var $item = $('.item').remove().
methods({
load: function(attribs) {
this.set(attribs);
this.e.trigger('item:loaded',this);
return this;
},
set: function(attribs) {
this.id = attribs.id;
// global set by server
COMMENTS = [{'title': 'hello', 'body': 'im a lonley comment'}];
// template & controller codez together as friends
html5(function(html) {
html.import('jquery');
html.import('json');
html.n('body', function(body) {